Eric Botti
commited on
Commit
·
06aab8b
1
Parent(s):
cd0e3a6
experimental animal match tool
Browse files- src/reasoning_tools.py +24 -0
src/reasoning_tools.py
CHANGED
@@ -24,6 +24,30 @@ def get_likely_animals(description: str) -> str:
|
|
24 |
"""Provides animals from a description"""
|
25 |
return likely_animals_chain.run(animal_description=description)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
tools = [
|
28 |
Tool(
|
29 |
name='get_likely_animals',
|
|
|
24 |
"""Provides animals from a description"""
|
25 |
return likely_animals_chain.run(animal_description=description)
|
26 |
|
27 |
+
|
28 |
+
# Animal Match Tool
|
29 |
+
ANIMAL_MATCH_PROMPT = """\
|
30 |
+
Consider whether the following animal matches with the description provided. Provide your logic for reaching the conclusion.
|
31 |
+
ANIMAL:
|
32 |
+
{animal}
|
33 |
+
Description:
|
34 |
+
{description}
|
35 |
+
Your Thoughts:
|
36 |
+
"""
|
37 |
+
|
38 |
+
animal_match_template = PromptTemplate(
|
39 |
+
input_variables=['animal', 'description'],
|
40 |
+
template=ANIMAL_MATCH_PROMPT
|
41 |
+
)
|
42 |
+
|
43 |
+
animal_match_tool = LLMChain(llm=tool_llm, prompt=likely_animals_prompt)
|
44 |
+
|
45 |
+
|
46 |
+
def does_animal_match_description(animal: str, description: str) -> str:
|
47 |
+
"""Given an animal and a description, consider whether the animal matches that description"""
|
48 |
+
return animal_match_tool.run(animal=animal, description=description)
|
49 |
+
|
50 |
+
|
51 |
tools = [
|
52 |
Tool(
|
53 |
name='get_likely_animals',
|