community: fix DallE hidden open_api_key (#26996)

Thank you for contributing to LangChain!

- [ X] **PR title**: "package: description"
- Where "package" is whichever of langchain, community, core, etc. is
being modified. Use "docs: ..." for purely docs changes, "templates:
..." for template changes, "infra: ..." for CI changes.
  - Example: "community: add foobar LLM"


- [ X] 
    - **Issue:** issue #26941


Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
bbaltagi-dtsl 2024-10-21 21:46:56 +02:00 committed by GitHub
parent c6d088bc15
commit 403c0ea801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,7 +116,9 @@ class DallEAPIWrapper(BaseModel):
if is_openai_v1(): if is_openai_v1():
client_params = { client_params = {
"api_key": self.openai_api_key, "api_key": self.openai_api_key.get_secret_value()
if self.openai_api_key
else None,
"organization": self.openai_organization, "organization": self.openai_organization,
"base_url": self.openai_api_base, "base_url": self.openai_api_base,
"timeout": self.request_timeout, "timeout": self.request_timeout,