Skip to content

Commit decd77c

Browse files
JustNawafefriis
andauthored
community: fix an issue with deepinfra integration (#28715)
Thank you for contributing to LangChain! - [x] **PR title**: langchain: add URL parameter to ChatDeepInfra class - [x] **PR message**: add URL parameter to ChatDeepInfra class - **Description:** This PR introduces a url parameter to the ChatDeepInfra class in LangChain, allowing users to specify a custom URL. Previously, the URL for the DeepInfra API was hardcoded to "https://stage.api.deepinfra.com/v1/openai/chat/completions", which caused issues when the staging endpoint was not functional. The _url method was updated to return the value from the url parameter, enabling greater flexibility and addressing the problem. out! --------- Co-authored-by: Erick Friis <erick@langchain.dev>
1 parent 008efad commit decd77c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libs/community/langchain_community/chat_models/deepinfra.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ class ChatDeepInfra(BaseChatModel):
207207
# client: Any #: :meta private:
208208
model_name: str = Field(default="meta-llama/Llama-2-70b-chat-hf", alias="model")
209209
"""Model name to use."""
210+
211+
url: str = "https://api.deepinfra.com/v1/openai/chat/completions"
212+
"""URL to use for the API call."""
213+
210214
deepinfra_api_token: Optional[str] = None
211215
request_timeout: Optional[float] = Field(default=None, alias="timeout")
212216
temperature: Optional[float] = 1
@@ -469,7 +473,7 @@ def _handle_status(self, code: int, text: Any) -> None:
469473
)
470474

471475
def _url(self) -> str:
472-
return "https://stage.api.deepinfra.com/v1/openai/chat/completions"
476+
return self.url
473477

474478
def _headers(self) -> Dict:
475479
return {

0 commit comments

Comments
 (0)