"""English customer-support examples using the official TypeSafe Python SDK.""" import argparse import os from typesafe_sdk import Choice, Noul, RetryPolicy, Score, TypeSafeClient def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--base-url", default="http://127.0.0.1:30013") parser.add_argument("--model", default="APUS-OpenJev-v1-9B") parser.add_argument("--effort", choices=["low", "high"], default="high") args = parser.parse_args() with TypeSafeClient( base_url=args.base_url, api_key=os.environ["JEV_API_KEY"], model=args.model, retry=RetryPolicy(max_retries=0), ) as client: print(client.models.list().model_dump_json(indent=2)) result = client.system_one( state={ "customer_message": "My order arrived damaged yesterday. I would like a refund.", "policy": "A damaged item reported within 30 days is eligible for a refund.", }, questions={ "support_queue": Choice( instructions="Choose the team that should handle this ticket.", criteria={ "returns": "Damaged items, returns, and refunds", "billing": "Invoice or payment issues", "shipping": "Tracking and delivery updates", }, ), "refund_eligible": Noul( instructions="Does the stated policy make this customer eligible for a refund?" ), "urgency": Score( instructions="Rate the urgency of this support ticket.", criteria=[ "Routine question", "Customer needs timely assistance", "Immediate safety or security risk", ], ), }, extra_body={"effort": args.effort}, ) print(result.model_dump_json(indent=2)) print("Effort:", result.raw_http_response.headers.get("x-openjev-effort")) print( "Configured execution layers:", result.raw_http_response.headers.get("x-openjev-executed-layers"), ) if __name__ == "__main__": main()