Update chat.py
Browse files
chat.py
CHANGED
@@ -21,7 +21,7 @@ def segmind_input_parser(input):
|
|
21 |
toreturn.append({'role':thisdict['role'],'content':thisdict['context']})
|
22 |
return toreturn
|
23 |
def segmind_output_parser(input):
|
24 |
-
return
|
25 |
def converse(conversation,provider,model,key,other:dict={}):
|
26 |
if(provider=='groq'):
|
27 |
chat = ChatGroq(temperature=0, groq_api_key=key, model_name=model)
|
|
|
21 |
toreturn.append({'role':thisdict['role'],'content':thisdict['context']})
|
22 |
return toreturn
|
23 |
def segmind_output_parser(input):
|
24 |
+
return {"content": input['choices'][0]['message']['content'], "additional_kwargs": {}, "response_metadata": {}, "type": "ai", "name": None, "id": input['id'], "example": False, "tool_calls": [], "invalid_tool_calls": [], "usage_metadata": {"input_tokens": input['usage']['prompt_tokens'], "output_tokens": input['usage']['completion_tokens'], "total_tokens": input['usage']['total_tokens']}}
|
25 |
def converse(conversation,provider,model,key,other:dict={}):
|
26 |
if(provider=='groq'):
|
27 |
chat = ChatGroq(temperature=0, groq_api_key=key, model_name=model)
|