Closed minpeter closed 3 months ago
Also, after applying the PR below, the example of fireworks AI, which was not working for some reason, started to stop working.
I can't test it with the subtitle of free credits, but it's probably a positive patch for groq and Perplexity as well.
Description
referring to providers/ai-sdk-providers/fireworks and docs/getting-started/nextjs-app-router, and got the following results.
In the latter case, it returns that the content of the messages field cannot begin with a list.
I think this is a problem with the recently changed role of openai's messages field being changed to the form below instead of a string.
This issue has not been reported yet, but I believe it is a possible issue for most providers that use the
createOpenAI method of
@ai-sdk/openai`. (Perplexity - Perplexity api docs)To solve this problem, I would like to suggest changing the user role's message to also be sent as a string once the compatibility option in createOpenAI is set to
compatibility: "compatible"
.*I like the code that I use for the added features. (ref: https://github.com/vercel/ai/commit/2b18fa11ba343bf09eb879607da41fc3f4fa7599) I don't think it's possible to use this code, but it's recommended to use the API provider. https://github.com/vercel/ai/blob/8e1f7e395daa8e75abcb33c180f9dd0f59cba570/packages/openai/src/openai-chat-language-model.ts#L406
| Lastly, I apologize for my poor English and explanation.
Code example
app/api/chat/route.ts
Additional context
Completions that send the messages[0].content field entirely as a string succeed successfully on all providers. However, in this case, function calling is not possible.