Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -159,10 +159,13 @@ def respond(
|
|
159 |
client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
160 |
generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
|
161 |
question_history = ""
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
164 |
|
165 |
-
messages.append({"role": "user", "content":
|
166 |
|
167 |
response = client.chat_completion( messages, max_tokens=150)
|
168 |
response = str(response)
|
|
|
159 |
client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
160 |
generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
|
161 |
question_history = ""
|
162 |
+
system_message = f'You are a helpful assistant with access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> Choose functions wisely and Also reply wisely, reply with just functioncall only as tell you before, Make function while learning from Prev Questions But make sure to create function call only for Curent Question.'
|
163 |
+
messages = [{"role": "system", "content": system_message}]
|
164 |
+
for val in history:
|
165 |
+
if val[0]:
|
166 |
+
messages.append({"role": "user", "content": f"{str(val[0])}"})
|
167 |
|
168 |
+
messages.append({"role": "user", "content": message_text})
|
169 |
|
170 |
response = client.chat_completion( messages, max_tokens=150)
|
171 |
response = str(response)
|