The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Invoke callback prior to yielding token (openai) (#18628)
Yudhajit Sinha140f06e59a03
diff --git a/libs/community/langchain_community/llms/openai.py b/libs/community/langchain_community/llms/openai.pyindex 7f0aa07548..ce35db32e3 100644--- a/libs/community/langchain_community/llms/openai.py+++ b/libs/community/langchain_community/llms/openai.py@@ -365,7 +365,6 @@ class BaseOpenAI(BaseLLM):if not isinstance(stream_resp, dict):stream_resp = stream_resp.dict()chunk = _stream_response_to_generation_chunk(stream_resp)- yield chunkif run_manager:run_manager.on_llm_new_token(chunk.text,@@ -375,6 +374,7 @@ class BaseOpenAI(BaseLLM):if chunk.generation_infoelse None,)+ yield chunkasync def _astream(self,