You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bug
When streaming the LLM output, prior role prompts are being included in the output. This issue was previously reported in (#943) with version 0.1.16, but it still persists in 0.2.0. There is likely a way to hardcode which outputs are from the assistant, but if there is a different recommended approach to streaming or a fix, please let me know.
To Reproduce
asyncdefstream_output(lm):
@guidancedefllm_streamer(lm):
withassistant():
lm+=gen("answer")
returnlmwithsystem():
lm+="You are a helpful assistant"withuser():
lm+="Write me a poem in 10 words"fortokeninlm.stream() +llm_streamer():
yieldstr(token)
asyncdefmain():
try:
model=models.OpenAI("gpt-4o-mini")
asyncfortokeninstream_output(model):
print(token)
print()
exceptExceptionase:
print(f"Unexpected error: {e}")
if__name__=='__main__':
asyncio.run(main())
Last Couple of outputs:
<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
Write me a poem in 10 words<|im_end|>
<|im_start|>assistant
Whispers of dawn, dreams take flight, hearts entwined, love's
<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
Write me a poem in 10 words<|im_end|>
<|im_start|>assistant
Whispers of dawn, dreams take flight, hearts entwined, love's light
<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
Write me a poem in 10 words<|im_end|>
<|im_start|>assistant
Whispers of dawn, dreams take flight, hearts entwined, love's light.
System info (please complete the following information):
OS (e.g. Ubuntu, Windows 11, Mac OS, etc.): Mac OS 14.6.1
Guidance Version (guidance.__version__): 0.2.0
The text was updated successfully, but these errors were encountered:
The bug
When streaming the LLM output, prior role prompts are being included in the output. This issue was previously reported in (#943) with version 0.1.16, but it still persists in 0.2.0. There is likely a way to hardcode which outputs are from the assistant, but if there is a different recommended approach to streaming or a fix, please let me know.
To Reproduce
Last Couple of outputs:
System info (please complete the following information):
guidance.__version__
): 0.2.0The text was updated successfully, but these errors were encountered: