Initial commit.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import asyncio
|
||||
from pyr.core.config import PyrConfig
|
||||
from pyr.core.app import create_app
|
||||
|
||||
|
||||
async def basic_example():
|
||||
config = PyrConfig(
|
||||
provider="openai",
|
||||
model="gpt-4o-mini",
|
||||
verbose=True
|
||||
)
|
||||
|
||||
async with create_app(config) as app:
|
||||
response = await app.ai_client.chat("user", "Hello! Can you help me with Python?")
|
||||
print("AI Response:", response)
|
||||
|
||||
|
||||
async def tool_example():
|
||||
config = PyrConfig(use_tools=True)
|
||||
|
||||
async with create_app(config) as app:
|
||||
response = await app.chat_with_tools(
|
||||
"user",
|
||||
"Create a Python file called hello.py with a simple greeting function"
|
||||
)
|
||||
print("Tool-enhanced response:", response)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("PYR Basic Usage Examples")
|
||||
print("=" * 30)
|
||||
|
||||
print("\n1. Basic chat example:")
|
||||
asyncio.run(basic_example())
|
||||
|
||||
print("\n2. Tool usage example:")
|
||||
asyncio.run(tool_example())
|
||||
Reference in New Issue
Block a user