8000 fix: tavily/obot search: add time_range parameter by g-linville · Pull Request #645 · obot-platform/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: tavily/obot search: add time_range parameter #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025

Conversation

g-linville
Copy link
Member

for obot-platform/obot#2600

I hate marring such a beautifully simple, single-parameter tool by adding a second param, but there isn't another way that I know of to fix the issue I linked above.

Signed-off-by: Grant Linville <grant@acorn.io>
Comment on lines 56 to 76
if time_range:
response = client.search(
query=query,
include_answer=os.getenv("INCLUDE_ANSWER", "").lower()
== "true", # no LLM-generated answer needed by default - we'll do that
include_raw_content=os.getenv("INCLUDE_RAW_CONTENT", "").lower()
!= "false", # include raw content by default
max_results=max_results,
include_domains=include_domains,
time_range=time_range,
)
else:
response = client.search(
query=query,
include_answer=os.getenv("INCLUDE_ANSWER", "").lower()
== "true", # no LLM-generated answer needed by default - we'll do that
include_raw_content=os.getenv("INCLUDE_RAW_CONTENT", "").lower()
!= "false", # include raw content by default
max_results=max_results,
include_domains=include_domains,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if time_range:
response = client.search(
query=query,
include_answer=os.getenv("INCLUDE_ANSWER", "").lower()
== "true", # no LLM-generated answer needed by default - we'll do that
include_raw_content=os.getenv("INCLUDE_RAW_CONTENT", "").lower()
!= "false", # include raw content by default
max_results=max_results,
include_domains=include_domains,
time_range=time_range,
)
else:
response = client.search(
query=query,
include_answer=os.getenv("INCLUDE_ANSWER", "").lower()
== "true", # no LLM-generated answer needed by default - we'll do that
include_raw_content=os.getenv("INCLUDE_RAW_CONTENT", "").lower()
!= "false", # include raw content by default
max_results=max_results,
include_domains=include_domains,
)
search_kwargs = {
"query": query,
"include_answer": os.getenv("INCLUDE_ANSWER", "").lower() == "true",
"include_raw_content": os.getenv("INCLUDE_RAW_CONTENT", "").lower() != "false",
"max_results": max_results,
"include_domains": include_domains,
}
if time_range:
search_kwargs["time_range"] = time_range
response = client.search(**search_kwargs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Signed-off-by: Grant Linville <grant@acorn.io>
@g-linville g-linville requested a review from tybalex May 9, 2025 01:59
@g-linville g-linville merged commit 98d00c2 into obot-platform:main May 9, 2025
2 checks passed
@g-linville g-linville deleted the tavily-add-time-range branch May 9, 2025 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0