first commit
This commit is contained in:
17
test_query.py
Normal file
17
test_query.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import asyncio
|
||||
|
||||
async def main():
|
||||
from claude_agent_sdk import query, ClaudeAgentOptions
|
||||
|
||||
options = ClaudeAgentOptions(model="claude-3-5-sonnet-20241022", system_prompt="You are a helpful assistant.")
|
||||
async for msg in query(prompt="Say a short hello.", options=options):
|
||||
print(f"Message type: {type(msg)}")
|
||||
print(f"Message content: {getattr(msg, 'content', 'No content')}")
|
||||
if hasattr(msg, 'total_cost_usd'):
|
||||
print(f"Cost: {msg.total_cost_usd}")
|
||||
print(f"Usage: {getattr(msg, 'usage', 'No usage')}")
|
||||
if hasattr(msg, '__dict__'):
|
||||
print(f"Dict keys: {msg.__dict__.keys()}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user