Update chat.py
Browse files
chat.py
CHANGED
|
@@ -16,6 +16,14 @@ def langchainConversation(conversation):
|
|
| 16 |
chat_template = ChatPromptTemplate.from_messages(prompts)
|
| 17 |
return chat_template.format_messages()
|
| 18 |
def segmind_input_parser(input):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
toreturn = []
|
| 20 |
for thisdict in input:
|
| 21 |
toreturn.append({'role':thisdict['role'],'content':thisdict['context']})
|
|
|
|
| 16 |
chat_template = ChatPromptTemplate.from_messages(prompts)
|
| 17 |
return chat_template.format_messages()
|
| 18 |
def segmind_input_parser(input):
|
| 19 |
+
toreturn = []
|
| 20 |
+
for thisdict in input:
|
| 21 |
+
if(thisdidt['role'] == 'ai'):
|
| 22 |
+
toreturn.append({'role':'assistant','content':thisdict['context']})
|
| 23 |
+
else:
|
| 24 |
+
toreturn.append({'role':thisdict['role'],'content':thisdict['context']})
|
| 25 |
+
return toreturn
|
| 26 |
+
def workers_input_parser(input):
|
| 27 |
toreturn = []
|
| 28 |
for thisdict in input:
|
| 29 |
toreturn.append({'role':thisdict['role'],'content':thisdict['context']})
|