-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposio_example.py
46 lines (34 loc) · 1.45 KB
/
composio_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from src.toolfuzz.agent_executors.langchain.react_new import ReactAgentNew
from src.toolfuzz.correctness.correctness_fuzzer import CorrectnessTester
from src.toolfuzz.runtime.runtime_fuzzer import RuntimeErrorTester
def example_runtime_failure_fuzzing():
from composio_langchain import ComposioToolSet, App
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model='gpt-4o-mini')
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_tools(apps=[App.SHELLTOOL])
tool = tools[0]
agent = ReactAgentNew(tool, llm)
tester = RuntimeErrorTester(llm=llm,
tool=tool,
agent=agent,
fuzzer_iters=50)
tester.test()
tester.save('composio_runtime_results')
def example_correctness_usage():
from composio_langchain import ComposioToolSet, App
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model='gpt-4o')
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_tools(apps=[App.SHELLTOOL])
tool = tools[0]
agent = ReactAgentNew(tool, llm)
tester = CorrectnessTester(llm=llm,
tool=tool,
agent=agent,
additional_context='')
tester.test()
tester.save('composio_correctness_results')
if __name__ == '__main__':
example_runtime_failure_fuzzing()
example_correctness_usage()