Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,10 +74,12 @@ for message in st.session_state.messages:
|
|
74 |
def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
|
75 |
"""Yield chat response content from the Groq API response."""
|
76 |
for chunk in chat_completion:
|
77 |
-
if chunk.choices
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
81 |
function_name = tool_call.function.name
|
82 |
if function_name == "time_date":
|
83 |
owner_info = get_tool_owner_info()
|
@@ -162,7 +164,6 @@ if prompt := st.chat_input("Enter your prompt here..."):
|
|
162 |
st.markdown(prompt)
|
163 |
|
164 |
chat_responses_generator = None
|
165 |
-
full_response = None
|
166 |
|
167 |
try:
|
168 |
chat_completion = client.chat.completions.create(
|
|
|
74 |
def generate_chat_responses(chat_completion) -> Generator[str, None, None]:
|
75 |
"""Yield chat response content from the Groq API response."""
|
76 |
for chunk in chat_completion:
|
77 |
+
if chunk.choices:
|
78 |
+
for choice in chunk.choices:
|
79 |
+
if choice.delta.content:
|
80 |
+
yield choice.delta.content
|
81 |
+
if chunk.message.tool_calls:
|
82 |
+
for tool_call in chunk.message.tool_calls:
|
83 |
function_name = tool_call.function.name
|
84 |
if function_name == "time_date":
|
85 |
owner_info = get_tool_owner_info()
|
|
|
164 |
st.markdown(prompt)
|
165 |
|
166 |
chat_responses_generator = None
|
|
|
167 |
|
168 |
try:
|
169 |
chat_completion = client.chat.completions.create(
|