#Multi-step query

1 messages · Page 1 of 1 (latest)

loud socket
#

I'm still not understanding a multi-step query. For example, let's say I have two resources:

nutrition.json - contains a list of ingredients and their micronutrient values (vitamin a, vitamin c, etc)

recipes.json - contains a list of of recipes (name, ingredients+amounts, yield)

I want the user to be able to ask something like "which recipes have the most vitamin c?"

I understand that this won't work in semantic search (knowledge docs, vector db) because there's no sorting in that format. I can write a tool function like def get_top_recipes_by_nutrient(nutrient, count=3):, but I'm not clear on how the model will formulate parameters. How does it choose to use "vitamin c", "vitamin_c", or even a pseudonym like "ascorbic acid"?

Suppose I add another layer of complexity with a third resource:

disease_treatment.json - contains a list of diseases and recommended nutrients for treatment

Now the user might ask: "What's a good soup for fighting a cold"? The model needs to find "common cold" in the disease_treatment data, then search for recipes that have a high concentration of one or more vitamins. This is a bit more abstract than a single tool function. Am I overcomplicating this? I would greatly appreciate some guidance.

inland sunBOT
#

Hi @loud socket. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain specific information on how to handle multi-step queries involving multiple resources like nutrition.json, recipes.json, and disease_treatment.json.

However, OpenAI has developed advanced AI models like GPT-3 that can handle complex tasks. For instance, in the context of writing unit tests, a multi-step prompt can be used to generate text from GPT-3 and then feed that output text back into subsequent prompts. This can help in cases where you want GPT-3 to reason things out before answering, or brainstorm a plan before executing it (source (https://cookbook.openai.com/examples/unit_test_writing_using_a_multi-step_prompt)).

For your specific use case, you might need to develop a custom solution that involves multiple steps and possibly multiple AI models or functions. This could involve first identifying the relevant nutrient or nutrients for a given disease, then finding recipes that are high in those nutrients.

For more detailed guidance, I would recommend checking out the OpenAI Cookbook's example notebooks (source (https://github.com/openai/openai-cookbook)) and the OpenAI API documentation (source (https://platform.openai.com/docs)). These resources provide a wealth of information on how to use OpenAI's models and APIs for a variety of tasks.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@loud socket kapa.ai is still learning and improving, please let us know how it did by reacting below

loud socket
#

@inland sun Let's try again. I want to enable the user to ask questions that require a multi-stage operation of sorting through more than one data set. How is this accomplished? I'm thinking the Assistant API will call multiple tools, but I can't find any examples of an implementation of this online. How would it know what order to call which tools in?

inland sunBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Based on the information provided in the extracts, it seems that the Assistant API can indeed call multiple tools, but the specifics of how this is done and the order in which the tools are called are not detailed.

In the forum post titled "Assistant API] Discrepancies in Function Triggering and Output Submission in Bulk Message Threads with OpenAI API", a user named Dayrion is advised to change their tool submission so that they only provide those calls that are asked when the RUN has requires_action status ([source (https://community.openai.com/t/585770)). This suggests that the Assistant API can determine which tools it needs to call based on the context of the task at hand.

However, the specifics of how to implement a multi-stage operation that involves sorting through more than one data set are not provided in the extracts. It's likely that this would involve writing custom code to handle the different stages of the operation and ensure that the correct tools are called in the correct order.

For more detailed guidance on how to use the Assistant API and its tools, I would recommend checking out the OpenAI API documentation (source (https://platform.openai.com/docs)) and the OpenAI Cookbook's example notebooks (source (https://github.com/openai/openai-cookbook)). These resources provide a wealth of information on how to use OpenAI's models and APIs for a variety of tasks.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: