-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlitellm-gemini3.py
More file actions
52 lines (42 loc) · 1.31 KB
/
Copy pathlitellm-gemini3.py
File metadata and controls
52 lines (42 loc) · 1.31 KB
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
47
48
49
50
51
52
from agents import Agent, ModelSettings, Runner, function_tool
from agents.extensions.models.litellm_model import LitellmModel
from openai.types.shared import Reasoning
@function_tool
def echo_tool(input: str) -> str:
print("called echo_tool")
return input
@function_tool
def speak_tool(input: str) -> str:
print("called speak_tool")
return input
@function_tool
def final_tool(input: str) -> str:
print("called final_tool")
return input
model = LitellmModel(
model="gemini/gemini-3-pro-preview"
)
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant",
model=model,
tools=[echo_tool, speak_tool, final_tool],
model_settings=ModelSettings(reasoning=Reasoning(effort="low"))
)
print("================================================ Turn 1")
result = Runner.run_sync(
agent, "think about life, then use echo_tool and speak_tool"
)
print(result.final_output)
print("----------")
messages = result.to_input_list()
print(messages)
print("================================================ Turn 2")
messages.append( { "role": "user", "content": "summarize the above content, then use final_tool"})
result = Runner.run_sync(
agent, messages
)
print("--------------------------------")
print(result.final_output)
print("----------")
print(result.to_input_list())