Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -157,12 +157,16 @@ def respond(
|
|
157 |
]
|
158 |
|
159 |
message_text = message["text"]
|
|
|
160 |
|
161 |
client_mixtral = InferenceClient("NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO")
|
162 |
client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
163 |
generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
|
|
|
|
|
|
|
164 |
|
165 |
-
messages.append({"role": "user", "content": f'[SYSTEM]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> [USER] {message_text} {vqa}'})
|
166 |
|
167 |
response = client.chat_completion( messages, max_tokens=150)
|
168 |
response = str(response)
|
|
|
157 |
]
|
158 |
|
159 |
message_text = message["text"]
|
160 |
+
|
161 |
|
162 |
client_mixtral = InferenceClient("NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO")
|
163 |
client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
164 |
generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False )
|
165 |
+
question_history = ""
|
166 |
+
for msg in history:
|
167 |
+
question_history += f"{str(msg[0])}/n"
|
168 |
|
169 |
+
messages.append({"role": "user", "content": f'[SYSTEM]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 . [PREV_QUESTIONS] {question_history} [USER] {message_text} {vqa}'})
|
170 |
|
171 |
response = client.chat_completion( messages, max_tokens=150)
|
172 |
response = str(response)
|