Update chat.py
Browse files
chat.py
CHANGED
|
@@ -50,7 +50,7 @@ def converse(conversation,provider,model,key,other:dict={}):
|
|
| 50 |
inputs = segmind_input_parser(conversation)
|
| 51 |
output = run(model, inputs)
|
| 52 |
print(output)
|
| 53 |
-
return {'content':output['result']['response']}
|
| 54 |
elif(provider == 'openrouter'):
|
| 55 |
chat = ChatOpenAI(
|
| 56 |
base_url="https://openrouter.ai/api/v1",
|
|
@@ -68,7 +68,7 @@ def converse(conversation,provider,model,key,other:dict={}):
|
|
| 68 |
response = requests.post(url, json=data, headers={'x-api-key': key})
|
| 69 |
output = json.loads(response.text)
|
| 70 |
print(json.dumps(output,indent=4))
|
| 71 |
-
return segmind_output_parser(output)
|
| 72 |
else:
|
| 73 |
return json.dumps({'content':'unspported Provider'})
|
| 74 |
return json.dumps(json.loads(chat.invoke(langchainConversation(conversation)).json()),indent=4)
|
|
|
|
| 50 |
inputs = segmind_input_parser(conversation)
|
| 51 |
output = run(model, inputs)
|
| 52 |
print(output)
|
| 53 |
+
return json.dumps({'content':output['result']['response']},indent=4)
|
| 54 |
elif(provider == 'openrouter'):
|
| 55 |
chat = ChatOpenAI(
|
| 56 |
base_url="https://openrouter.ai/api/v1",
|
|
|
|
| 68 |
response = requests.post(url, json=data, headers={'x-api-key': key})
|
| 69 |
output = json.loads(response.text)
|
| 70 |
print(json.dumps(output,indent=4))
|
| 71 |
+
return json.dumps(segmind_output_parser(output),indent=4)
|
| 72 |
else:
|
| 73 |
return json.dumps({'content':'unspported Provider'})
|
| 74 |
return json.dumps(json.loads(chat.invoke(langchainConversation(conversation)).json()),indent=4)
|