from opperai import Opperimport timeopper = Opper(http_bearer="YOUR_API_KEY")# First, create a function to callunique_name = f"geography_expert_{int(time.time())}"created_function = opper.functions.create( name=unique_name, description="Expert in world geography and capital cities", instructions="You are a geography expert. Answer questions about countries, capitals, and geography clearly and accurately.", model="openai/gpt-4o-mini",)print(f"Created function with ID: {created_function.id}")# Call the function with input dataresponse = opper.functions.call( function_id=created_function.id, input={ "question": "What is the capital of France?", "context": "We are discussing European geography.", }, tags={"user": "demo_user", "session": "session_123"},)print(f"Span ID: {response.span_id}")if response.message: print(f"Message: {response.message}")if response.json_payload: print(f"JSON Response: {response.json_payload}")print(f"Cached: {response.cached}")
from opperai import Opperimport timeopper = Opper(http_bearer="YOUR_API_KEY")# First, create a function to callunique_name = f"geography_expert_{int(time.time())}"created_function = opper.functions.create( name=unique_name, description="Expert in world geography and capital cities", instructions="You are a geography expert. Answer questions about countries, capitals, and geography clearly and accurately.", model="openai/gpt-4o-mini",)print(f"Created function with ID: {created_function.id}")# Call the function with input dataresponse = opper.functions.call( function_id=created_function.id, input={ "question": "What is the capital of France?", "context": "We are discussing European geography.", }, tags={"user": "demo_user", "session": "session_123"},)print(f"Span ID: {response.span_id}")if response.message: print(f"Message: {response.message}")if response.json_payload: print(f"JSON Response: {response.json_payload}")print(f"Cached: {response.cached}")