Skip to content

Commit 7273c3e

Browse files
marijahorvat171ivicac
authored andcommitted
2319 - add tavily component
1 parent 993df0d commit 7273c3e

File tree

13 files changed

+977
-0
lines changed

13 files changed

+977
-0
lines changed

server/apps/server-app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ implementation(project(":server:libs:modules:components:bolna"))
283283
implementation(project(":server:libs:modules:components:spotify"))
284284
implementation(project(":server:libs:modules:components:stripe"))
285285
implementation(project(":server:libs:modules:components:supabase"))
286+
implementation(project(":server:libs:modules:components:tavily"))
286287
implementation(project(":server:libs:modules:components:teamwork"))
287288
implementation(project(":server:libs:modules:components:text-helper"))
288289
implementation(project(":server:libs:modules:components:todoist"))

server/ee/apps/worker-app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ implementation(project(":server:libs:modules:components:graphql-client"))
205205
implementation(project(":server:libs:modules:components:spotify"))
206206
implementation(project(":server:libs:modules:components:stripe"))
207207
implementation(project(":server:libs:modules:components:supabase"))
208+
implementation(project(":server:libs:modules:components:tavily"))
208209
implementation(project(":server:libs:modules:components:teamwork"))
209210
implementation(project(":server:libs:modules:components:text-helper"))
210211
implementation(project(":server:libs:modules:components:todoist"))
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
openapi: "3.0.1"
3+
info:
4+
title: "Tavily"
5+
description: "Tavily is an AI-powered search tool designed to help users quickly find accurate, relevant, and up-to-date information from the web."
6+
version: "v1"
7+
servers:
8+
- url: "https://api.tavily.com"
9+
paths:
10+
/search:
11+
post:
12+
summary: "Search"
13+
description: "Execute a search query."
14+
operationId: "search"
15+
x-ai-agent-tool: true
16+
requestBody:
17+
content:
18+
application/json:
19+
schema:
20+
type: "object"
21+
required:
22+
- "query"
23+
properties:
24+
query:
25+
type: "string"
26+
description: "The search query to execute."
27+
topic:
28+
type: "string"
29+
description: "The category of the search."
30+
default: "general"
31+
search_depth:
32+
type: "string"
33+
description: "The depth of the search."
34+
default: "basic"
35+
time_range:
36+
type: "string"
37+
description: "The time range back from the current date to filter results."
38+
max_results:
39+
type: "integer"
40+
description: "The maximum number of search results to return."
41+
default: "5"
42+
include_answer:
43+
type: "boolean"
44+
description: "Include an LLM-generated answer to the provided query."
45+
default: "false"
46+
include_images:
47+
type: "boolean"
48+
description: "Perform an image search and include the results in the response."
49+
default: "false"
50+
responses:
51+
200:
52+
description: "Successful operation."
53+
content:
54+
application/json:
55+
schema:
56+
type: "object"
57+
properties:
58+
query:
59+
type: "string"
60+
description: "The search query that was executed."
61+
answer:
62+
type: "string"
63+
description: "A short answer to the user's query, generated by an LLM. Included in the response only if include_answer is requested."
64+
images:
65+
type: "array"
66+
description: "List of query-related images."
67+
items:
68+
type: "object"
69+
results:
70+
type: "array"
71+
description: "A list of sorted search results, ranked by relevancy."
72+
items:
73+
type: "object"
74+
properties:
75+
title:
76+
type: "string"
77+
description: "The title of the search result."
78+
url:
79+
type: "string"
80+
description: "The URL of the search result."
81+
content:
82+
type: "string"
83+
description: "A short description of the search result."
84+
score:
85+
type: "number"
86+
description: "The relevance score of the search result."
87+
response_time:
88+
type: "number"
89+
description: "Time in seconds it took to complete the request."
90+
/extract:
91+
post:
92+
summary: "Extract"
93+
description: "Extract web page content from one or more specified URLs."
94+
operationId: "extract"
95+
x-ai-agent-tool: true
96+
requestBody:
97+
content:
98+
application/json:
99+
schema:
100+
type: "object"
101+
required:
102+
- "urls"
103+
properties:
104+
urls:
105+
type: "array"
106+
description: "A list of URLs to extract content from."
107+
items:
108+
type: "string"
109+
include_images:
110+
type: "boolean"
111+
description: "Include a list of images extracted from the URLs in the response."
112+
default: "false"
113+
extract_depth:
114+
type: "string"
115+
description: "The depth of the extraction process."
116+
default: "basic"
117+
responses:
118+
200:
119+
description: "Successful operation."
120+
content:
121+
application/json:
122+
schema:
123+
type: "object"
124+
properties:
125+
results:
126+
type: "array"
127+
description: "A list of extracted content from the provided URLs."
128+
items:
129+
type: "object"
130+
properties:
131+
url:
132+
type: "string"
133+
description: "The URL from which the content was extracted."
134+
raw_content:
135+
type: "string"
136+
description: "The full content extracted from the page."
137+
images:
138+
type: "array"
139+
description: "This is only available if include_images is set to true. A list of image URLs extracted from the page."
140+
items:
141+
type: "string"
142+
failed_results:
143+
type: "array"
144+
description: "A list of URLs that could not be processed."
145+
items:
146+
type: "object"
147+
properties:
148+
url:
149+
type: "string"
150+
description: "The URL that failed to be processed."
151+
error:
152+
type: "string"
153+
description: "An error message describing why the URL couldn't be processed."
154+
response_time:
155+
type: "number"
156+
description: "Time in seconds it took to complete the request."
157+
158+
components:
159+
securitySchemes:
160+
bearerAuth:
161+
scheme: "bearer"
162+
type: "http"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.tavily;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.component;
20+
import static com.bytechef.component.definition.ComponentDsl.tool;
21+
22+
import com.bytechef.component.OpenApiComponentHandler;
23+
import com.bytechef.component.definition.ComponentDefinition;
24+
import com.bytechef.component.tavily.action.TavilyExtractAction;
25+
import com.bytechef.component.tavily.action.TavilySearchAction;
26+
import com.bytechef.component.tavily.connection.TavilyConnection;
27+
28+
/**
29+
* Provides the base implementation for the REST based component.
30+
*
31+
* @generated
32+
*/
33+
public abstract class AbstractTavilyComponentHandler implements OpenApiComponentHandler {
34+
private final ComponentDefinition componentDefinition = modifyComponent(
35+
component("tavily")
36+
.title("Tavily")
37+
.description(
38+
"Tavily is an AI-powered search tool designed to help users quickly find accurate, relevant, and up-to-date information from the web."))
39+
.actions(modifyActions(TavilySearchAction.ACTION_DEFINITION, TavilyExtractAction.ACTION_DEFINITION))
40+
.connection(modifyConnection(TavilyConnection.CONNECTION_DEFINITION))
41+
.clusterElements(modifyClusterElements(tool(TavilySearchAction.ACTION_DEFINITION),
42+
tool(TavilyExtractAction.ACTION_DEFINITION)))
43+
.triggers(getTriggers());
44+
45+
@Override
46+
public ComponentDefinition getDefinition() {
47+
return componentDefinition;
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.tavily;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.option;
20+
21+
import com.bytechef.component.OpenApiComponentHandler;
22+
import com.bytechef.component.definition.ActionDefinition;
23+
import com.bytechef.component.definition.ComponentCategory;
24+
import com.bytechef.component.definition.ComponentDsl.ModifiableArrayProperty;
25+
import com.bytechef.component.definition.ComponentDsl.ModifiableComponentDefinition;
26+
import com.bytechef.component.definition.ComponentDsl.ModifiableProperty;
27+
import com.bytechef.component.definition.ComponentDsl.ModifiableStringProperty;
28+
import com.google.auto.service.AutoService;
29+
import java.util.Objects;
30+
31+
/**
32+
* This class will not be overwritten on the subsequent calls of the generator.
33+
*/
34+
@AutoService(OpenApiComponentHandler.class)
35+
public class TavilyComponentHandler extends AbstractTavilyComponentHandler {
36+
37+
@Override
38+
public ModifiableComponentDefinition modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition) {
39+
return modifiableComponentDefinition
40+
.icon("path:assets/tavily.svg")
41+
.categories(ComponentCategory.ARTIFICIAL_INTELLIGENCE);
42+
}
43+
44+
@Override
45+
public ModifiableProperty<?> modifyProperty(
46+
ActionDefinition actionDefinition, ModifiableProperty<?> modifiableProperty) {
47+
48+
if (Objects.equals(modifiableProperty.getName(), "topic")) {
49+
((ModifiableStringProperty) modifiableProperty)
50+
.options(
51+
option("General", "general", "general-purpose searches that may include a wide range of sources"),
52+
option("News", "news", "real-time updates"));
53+
} else if (Objects.equals(modifiableProperty.getName(), "search_depth")) {
54+
((ModifiableStringProperty) modifiableProperty)
55+
.options(
56+
option("Basic", "basic", "provides generic content snippets from each source"),
57+
option("Advanced", "advanced", "retrieves the most relevant sources"));
58+
} else if (Objects.equals(modifiableProperty.getName(), "time_range")) {
59+
((ModifiableStringProperty) modifiableProperty)
60+
.options(
61+
option("Day", "day", "returns results from the past 24 hours"),
62+
option("Week", "week", "returns results from the past 7 days"),
63+
option("Month", "month", "returns results from the past 30 days"),
64+
option("Year", "year", "returns results from the past 365 days"));
65+
} else if (Objects.equals(modifiableProperty.getName(), "urls")) {
66+
((ModifiableArrayProperty) modifiableProperty)
67+
.label("URLs");
68+
} else if (Objects.equals(modifiableProperty.getName(), "extract_depth")) {
69+
((ModifiableStringProperty) modifiableProperty)
70+
.options(
71+
option("Basic", "basic", "retrieves basic data"),
72+
option("Advanced", "advanced", "retrieves more data, including tables and embedded content"));
73+
}
74+
75+
return modifiableProperty;
76+
}
77+
}

0 commit comments

Comments
 (0)