Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions examples/01_standalone_sdk/58_ask_oracle_tool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from openhands.sdk import LLM, Agent, LocalConversation, Tool
from openhands.sdk.llm.llm_profile_store import LLMProfileStore
from openhands.tools.ask_oracle import ORACLE_PROFILE_NAME
from openhands.tools.ask_oracle import ORACLE_PROFILE_NAME, AskOracleTool


DEFAULT_BASE_URL = "https://llm-proxy.app.all-hands.dev"
Expand All @@ -40,7 +40,6 @@

with tempfile.TemporaryDirectory() as profile_store_dir:
store = LLMProfileStore(profile_store_dir)
# The Oracle model is saved under the conventional profile name "oracle".
store.save(
ORACLE_PROFILE_NAME,
LLM(
Expand All @@ -58,7 +57,7 @@
base_url=base_url,
usage_id="primary",
)
agent = Agent(llm=primary_llm, tools=[Tool(name="ask_oracle")])
agent = Agent(llm=primary_llm, tools=[Tool(name=AskOracleTool.name)])
conversation = LocalConversation(
agent=agent,
workspace=os.getcwd(),
Expand All @@ -73,6 +72,6 @@
)
conversation.run()

combined = conversation.state.stats.get_combined_metrics()
print(f"Total cost: ${combined.accumulated_cost:.6f}")
print(f"EXAMPLE_COST: {combined.accumulated_cost}")
cost = conversation.conversation_stats.get_combined_metrics().accumulated_cost
print(f"Total cost: ${cost:.6f}")
print(f"EXAMPLE_COST: {cost}")
Loading