Replies: 2 comments
-
the ai package requires a particular encoding to response with both the message and data. I don't find any document about this but take a look at this code. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Were you able to find the solution for it? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I'm trying to build a RAG using fastapi as backend. But I can't parse the different fields of my api in the application. Indeed, I need to retrieve the sources used in addition to the LLM answer. Here is a working exemple.
Here is the python fastapi code:
And the nextjs code:
After calling the API from the web app, the messages variable is filled with the API response. So I have an array with the the user content and the bot (api response) content:
However, I can't access document sources via {message.content}, because useChat return structured response with role and content but not answer and source, like defined in the API definition.
And if I try to parse the response content, I get an error:
Do you have any idea to retrieve the API structure in my web app ? I'm maybe not using well useChat.
Thanks in advance !
Beta Was this translation helpful? Give feedback.
All reactions