Can't figure out how to get a final answer out of a multi-turn generateText
#3210
Unanswered
austinm911
asked this question in
Help
Replies: 1 comment 2 replies
-
I realize this may be an issue with a) using a weaker model and b) the docs using OpenAIs model which has the strucutredOutput setting to true which is not available on other models. So for now, I'm getting around it by just using a 2nd generateObject function to take the previous text responses from the steps to try to return an object. However, the docs seem to suggest the expected behavior of using an |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's some pseudocode of what I'm trying to do. I've been using gemini flash 8b to test.
I basically have an array of objects with content that I want the model to iterate over, analyze each object of data, and then return a final answer based on all of the analysis.
However, i will pass in 5 objects of data and at the end it will return the text generation of the 5th object analysis. I can't figure out how to force the answer tool to be the last tool call to be executed which uses all of the generated intermediate steps of text to produce the final structured output.
Here this image, Langfuse maybe has a UI bug, but the last generation is the last object the model analyzes with the arrow pointing to it.
Here are the
steps
produced. The first index produces the desired results, but I still want the model to continue checking. On one hand I can't get the model to only check 2 indexes (maybe just small model issue)I have no problems if i prompt the model to stop and return an answer as soon as it gets the info from the 1st block. But when I edit my prompt to try to have the model "iterate further" im running into this issue.
Ultimately I expect that in this trace, the model uses all of the
text
generated to produce a final result, mostly relying on tool call 0 in this example.I'm referencing the https://sdk.vercel.ai/docs/ai-sdk-core/agents#structured-answers docs here and cannot get the model to terminate like the docs suggest 😔
Beta Was this translation helpful? Give feedback.
All reactions