Skip to content

Commit

Permalink
Merge branch 'master' into bagatur/update_to_3_15
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Oct 31, 2024
2 parents 888961f + f94125a commit 6320c85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions libs/community/langchain_community/adapters/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ def _convert_message_chunk(chunk: BaseMessageChunk, i: int) -> dict:
# not missing, but None.
if i == 0:
_dict["content"] = None
if "tool_calls" in chunk.additional_kwargs:
_dict["tool_calls"] = chunk.additional_kwargs["tool_calls"]
# If the first chunk is tool calls, the content is not empty string,
# not missing, but None.
if i == 0:
_dict["content"] = None
else:
_dict["content"] = chunk.content
else:
Expand Down
8 changes: 4 additions & 4 deletions libs/community/langchain_community/utilities/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_financials(self, ticker: str) -> Optional[dict]:
data = response.json()

status = data.get("status", None)
if status not in ("OK", "STOCKBUSINESS"):
if status not in ("OK", "STOCKBUSINESS", "STOCKSBUSINESS"):
raise ValueError(f"API Error: {data}")

return data.get("results", None)
Expand All @@ -61,7 +61,7 @@ def get_last_quote(self, ticker: str) -> Optional[dict]:
data = response.json()

status = data.get("status", None)
if status not in ("OK", "STOCKBUSINESS"):
if status not in ("OK", "STOCKBUSINESS", "STOCKSBUSINESS"):
raise ValueError(f"API Error: {data}")

return data.get("results", None)
Expand All @@ -82,7 +82,7 @@ def get_ticker_news(self, ticker: str) -> Optional[dict]:
data = response.json()

status = data.get("status", None)
if status not in ("OK", "STOCKBUSINESS"):
if status not in ("OK", "STOCKBUSINESS", "STOCKSBUSINESS"):
raise ValueError(f"API Error: {data}")

return data.get("results", None)
Expand Down Expand Up @@ -116,7 +116,7 @@ def get_aggregates(self, ticker: str, **kwargs: Any) -> Optional[dict]:
data = response.json()

status = data.get("status", None)
if status not in ("OK", "STOCKBUSINESS"):
if status not in ("OK", "STOCKBUSINESS", "STOCKSBUSINESS"):
raise ValueError(f"API Error: {data}")

return data.get("results", None)
Expand Down

0 comments on commit 6320c85

Please sign in to comment.