Spaces:
Sleeping
Sleeping
Feat: species differences in ST
Browse files
app.py
CHANGED
@@ -46,23 +46,27 @@ def get_star_trek_quote(character: str)-> str: #it's import to specify the retur
|
|
46 |
else:
|
47 |
return f"Sorry, no quotes available for {character}. Please provide a valid Star Trek character name."
|
48 |
|
49 |
-
# To invoke this tool, just type something like "How many tribbles are there? or "Check the Tribble infestation!"
|
50 |
@tool
|
51 |
-
def
|
52 |
"""
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
|
55 |
Returns:
|
56 |
-
A
|
57 |
"""
|
58 |
-
|
59 |
-
if tribbles_count > 500:
|
60 |
-
return f"There are {tribbles_count} Tribbles aboard! It's a *serious* infestation!"
|
61 |
-
elif tribbles_count > 200:
|
62 |
-
return f"There are {tribbles_count} Tribbles aboard. It's getting out of hand!"
|
63 |
-
else:
|
64 |
-
return f"There are {tribbles_count} Tribbles aboard. It's under control...for now."
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
@tool
|
67 |
def get_current_time_in_timezone(timezone: str) -> str:
|
68 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -100,7 +104,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
100 |
|
101 |
agent = CodeAgent(
|
102 |
model=model,
|
103 |
-
tools=[final_answer, get_star_trek_quote,
|
104 |
max_steps=6,
|
105 |
verbosity_level=1,
|
106 |
grammar=None,
|
|
|
46 |
else:
|
47 |
return f"Sorry, no quotes available for {character}. Please provide a valid Star Trek character name."
|
48 |
|
|
|
49 |
@tool
|
50 |
+
def analyze_species_difference(species1: str, species2: str) -> str:
|
51 |
"""
|
52 |
+
Analyze the physiological difference between two Star Trek species using a search engine.
|
53 |
+
|
54 |
+
Args:
|
55 |
+
species1: The first species (e.g., "Vulkan", "Human").
|
56 |
+
species2: The second species (e.g., "Klingon", "Romulan").
|
57 |
|
58 |
Returns:
|
59 |
+
A detailed analysis based on the search of results.
|
60 |
"""
|
61 |
+
query = f"Physiological differences between {species1} and {species2} in Star Trek"
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
search_results = DuckDuckGoSearchTool(query)
|
64 |
+
|
65 |
+
if search_results:
|
66 |
+
return f"Based on the research, here's a comparison between {species1} and {species2}"
|
67 |
+
else:
|
68 |
+
return f"Sorry, I couldn't find information on the physiological differences between {species1} and {species2}. Please, try another query."
|
69 |
+
|
70 |
@tool
|
71 |
def get_current_time_in_timezone(timezone: str) -> str:
|
72 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
104 |
|
105 |
agent = CodeAgent(
|
106 |
model=model,
|
107 |
+
tools=[final_answer, get_star_trek_quote, analyze_species_difference], ## add your tools here (don't remove final answer)
|
108 |
max_steps=6,
|
109 |
verbosity_level=1,
|
110 |
grammar=None,
|