mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 05:43:55 +00:00
[partner]: ollama llm fix (#24790)
This commit is contained in:
parent
4bb1a11e02
commit
78d97b49d9
@ -304,11 +304,7 @@ class OllamaLLM(BaseLLM):
|
||||
for stream_resp in self._create_generate_stream(prompt, stop, **kwargs):
|
||||
if not isinstance(stream_resp, str):
|
||||
chunk = GenerationChunk(
|
||||
text=(
|
||||
stream_resp["message"]["content"]
|
||||
if "message" in stream_resp
|
||||
else ""
|
||||
),
|
||||
text=(stream_resp.get("response", "")),
|
||||
generation_info=(
|
||||
dict(stream_resp) if stream_resp.get("done") is True else None
|
||||
),
|
||||
@ -330,11 +326,7 @@ class OllamaLLM(BaseLLM):
|
||||
async for stream_resp in self._acreate_generate_stream(prompt, stop, **kwargs):
|
||||
if not isinstance(stream_resp, str):
|
||||
chunk = GenerationChunk(
|
||||
text=(
|
||||
stream_resp["message"]["content"]
|
||||
if "message" in stream_resp
|
||||
else ""
|
||||
),
|
||||
text=(stream_resp.get("response", "")),
|
||||
generation_info=(
|
||||
dict(stream_resp) if stream_resp.get("done") is True else None
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user