Skip to content

Commit

Permalink
issue #1153: add start chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Callocchia authored and danielecalda committed Dec 13, 2024
1 parent 504d76e commit 7898b2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ai-packages/rag-module/app/rag/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def get_chain(
rephrase_chain = rephrase_prompt | llm | parser
question = rephrase_chain.invoke({"question": question})

yield json.dumps({"chunk": "", "type": "START"})

for chunk in chain.stream({"question": question, "context": documents}):
yield json.dumps({"chunk": chunk, "type": "CHUNK"})

Expand Down Expand Up @@ -320,6 +322,8 @@ def get_chat_chain(
documents_id = set()
citations = []

yield json.dumps({"chunk": "", "type": "START"})

for chunk in result:
if "answer" in chunk.keys():
result_answer += chunk
Expand Down

0 comments on commit 7898b2b

Please sign in to comment.