Skip to content

feat: support multiple urls in Tavily tool #243

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 1 commit into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Chain/ToolBox/Tool/Tavily.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Tool integration of tavily.com.
*/
#[AsTool('tavily_search', description: 'search for information on the internet', method: 'search')]
#[AsTool('tavily_extract', description: 'fetch content from a website', method: 'extract')]
#[AsTool('tavily_extract', description: 'fetch content from websites', method: 'extract')]
final readonly class Tavily
{
/**
Expand Down Expand Up @@ -40,15 +40,13 @@ public function search(string $query): string
}

/**
* TODO: Support list of URLs.
*
* @param string $url URL to fetch information from
* @param string[] $urls URLs to fetch information from
*/
public function extract(string $url): string
public function extract(array $urls): string
{
$response = $this->httpClient->request('POST', 'https://api.tavily.com/extract', [
'json' => [
'urls' => [$url],
'urls' => $urls,
'api_key' => $this->apiKey,
],
]);
Expand Down