Closed dsolito closed 3 weeks ago
I tried with the python SDK and this is what I get :
from tavily import TavilyClient
tavily = TavilyClient(api_key=API_KEY)
print(tavily.search(query='how to cook a steak?', max_results=1, include_raw_content=True))
{
'query': 'how to cook a steak?',
'follow_up_questions': None,
'answer': None,
'images': [],
'results': [
{
'title': 'How To Cook Steak On The Stovetop - Once Upon a Chef',
'url': 'https://www.onceuponachef.com/recipes/how-to-cook-steak-on-the-stovetop.html',
'content': 'Pan-Seared Steaks\nPan-searing is the best way to cook a steak, and it’s also the easiest!\nIngredients\nInstructions\nPair
with\nNutrition Information\nPowered by\nThis website is written and produced for informational purposes only. When I do this again I will do for 5
minutes but will turn off the heat on my cast Iron frying pan 2 minutes before and add butter and rosemary and garlic to get the steak more to our
liking.\n I got a ribeye steak, heated the pan to the top heat and did everything like you mentioned, but after three minutes the steak was burned,
on the other side the same happened. After doing some more research, I find you have to bring the steak to room temperature before you cook it and
yiu have to snip the fat around the edges to keep it from curling. 22 Quick and Easy Recipes in 30 Minutes (or less) + 5 Chef Secrets To Make You A
Better Cook!\nFind a Recipe\nHow To Cook Steak On The Stovetop\nThis post may contain affiliate links.',
'score': 0.98533,
'raw_content': "22 Quick and Easy Recipes in 30 Minutes (or less) + 5 Chef Secrets To Make You A Better Cook!\nFind a Recipe\nHow To ... (text deleted)"
}
],
'response_time': 0.95
}
Hello @dsolito
It seems the two classes are supposed to used in order to build tool calling agents. And, creating two separate classes keeps it less confusing for the llms to choose either to get the current events from the TavilySearchResults or directly the answer from TavilyAnswer, based on the prompt instruction.
Hi @2020uce0047 Could make sense but why implement tavily Api arguments (include_raw_content, include_answer...)to the classes then?
Hi @dsolito I see the implementation both classes are using the same function raw_results
to get the output json from the API which accepts all the Api arguments. However, the TavilySearchResults
class does an extra cleaning through clean_results
to return only the content and url.
Working on this now
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
Hello, I cannot get all the informations requested from the parameters. Seems that only max_result is kept. I can understand that there is two classes (TavilySearchResults, TavilyAnswer) but if we can initiate TavilySearchResults with API options why to keep the two classes? D
System Info
System Information
Package Information