mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-14 15:52:11 +02:00
Fixing content mechanisms in API
This commit is contained in:
parent
3b6b035e6f
commit
c1749f9b85
2 changed files with 4 additions and 2 deletions
|
|
@ -206,8 +206,10 @@ class SocketClient:
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# RAG-style chunk (or generic chunk)
|
# RAG-style chunk (or generic chunk)
|
||||||
|
# Text-completion uses "response" field, RAG uses "chunk" field
|
||||||
|
content = resp.get("response", resp.get("chunk", ""))
|
||||||
return RAGChunk(
|
return RAGChunk(
|
||||||
content=resp.get("chunk", ""),
|
content=content,
|
||||||
end_of_stream=resp.get("end_of_stream", False),
|
end_of_stream=resp.get("end_of_stream", False),
|
||||||
error=resp.get("error")
|
error=resp.get("error")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ def query(url, flow_id, system, prompt, streaming=True, token=None):
|
||||||
if streaming:
|
if streaming:
|
||||||
# Stream output to stdout without newline
|
# Stream output to stdout without newline
|
||||||
for chunk in response:
|
for chunk in response:
|
||||||
print(chunk.content, end="", flush=True)
|
print(chunk, end="", flush=True)
|
||||||
# Add final newline after streaming
|
# Add final newline after streaming
|
||||||
print()
|
print()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue