pvanand commited on
Commit
b4b055b
1 Parent(s): 5284944

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -105,11 +105,11 @@ def chat_with_llama_stream(messages, model="gpt-3.5-turbo", max_llm_history=4, m
105
  )
106
 
107
  full_response = ""
108
- for event in response:
109
- if "content" in event["choices"][0].delta:
110
- current_response = event["choices"][0].delta.content
111
- full_response +=current_response
112
- yield current_response
113
 
114
  # After streaming, add the full response to the conversation history
115
  messages.append({"role": "assistant", "content": full_response})
 
105
  )
106
 
107
  full_response = ""
108
+ for chunk in response:
109
+ if chunk.choices[0].delta.content is not None:
110
+ content = chunk.choices[0].delta.content
111
+ full_response += content
112
+ yield content
113
 
114
  # After streaming, add the full response to the conversation history
115
  messages.append({"role": "assistant", "content": full_response})