How can the client record historical messages without calling the LangChain environment #686
-
When I built an API using Langserve and mimicked the demo in the example, the problem was how to record historical information in the input without calling modules such as HumanMessage if my client did not have a langchain environment. I tried to record in JSON format, but I couldn't find a suitable way to convert it to the corresponding format on the server side. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Resolved. I compose this input and the server's reply into a key-value pair on the client, and then append it to the history list and send it back to the server, and the server defines a init function in the original class input to convert the returned data into a List composed of HumanMessage and AIMessage, so as to achieve the purpose of retaining historical messages without calling langchain related libraries on the server. If there is any other way, I would be happy to know. |
Beta Was this translation helpful? Give feedback.
Resolved. I compose this input and the server's reply into a key-value pair on the client, and then append it to the history list and send it back to the server, and the server defines a init function in the original class input to convert the returned data into a List composed of HumanMessage and AIMessage, so as to achieve the purpose of retaining historical messages without calling langchain related libraries on the server. If there is any other way, I would be happy to know.