|
1 | | -"""Example usage of Edgee Gateway SDK""" |
| 1 | +"""Example usage of Edgee Gateway SDK |
2 | 2 |
|
3 | | -import os |
4 | | -import sys |
5 | | - |
6 | | -# Add parent directory to path for local testing |
7 | | -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 3 | +Install the package from PyPI: |
| 4 | + pip install edgee |
| 5 | +""" |
8 | 6 |
|
9 | 7 | from pydantic import BaseModel |
10 | 8 |
|
11 | | -from edgee import Edgee, Tool, create_tool |
12 | | - |
13 | | -edgee = Edgee(os.environ.get("EDGEE_API_KEY", "test-key")) |
| 9 | +from edgee import Edgee, EdgeeConfig, Tool, create_tool |
14 | 10 |
|
| 11 | +edgee = Edgee(api_key="YOUR_API_KEY") |
15 | 12 | # Test 1: Simple string input |
16 | 13 | print("Test 1: Simple string input") |
17 | 14 | response1 = edgee.send( |
18 | | - model="mistral/mistral-small-latest", |
| 15 | + model="devstral2", |
19 | 16 | input="What is the capital of France?", |
20 | 17 | ) |
21 | 18 | print(f"Content: {response1.text}") |
|
25 | 22 | # Test 2: Full input object with messages |
26 | 23 | print("Test 2: Full input object with messages") |
27 | 24 | response2 = edgee.send( |
28 | | - model="mistral/mistral-small-latest", |
| 25 | + model="devstral2", |
29 | 26 | input={ |
30 | 27 | "messages": [ |
31 | 28 | {"role": "system", "content": "You are a helpful assistant."}, |
|
39 | 36 | # Test 3: With tools |
40 | 37 | print("Test 3: With tools") |
41 | 38 | response3 = edgee.send( |
42 | | - model="gpt-4o", |
| 39 | + model="devstral2", |
43 | 40 | input={ |
44 | 41 | "messages": [{"role": "user", "content": "What is the weather in Paris?"}], |
45 | 42 | "tools": [ |
|
67 | 64 |
|
68 | 65 | # Test 4: Streaming |
69 | 66 | print("Test 4: Streaming") |
70 | | -for chunk in edgee.stream(model="mistral/mistral-small-latest", input="What is Python?"): |
| 67 | +for chunk in edgee.stream(model="devstral2", input="What is Python?"): |
71 | 68 | if chunk.text: |
72 | 69 | print(chunk.text, end="", flush=True) |
73 | 70 | print("\n") |
@@ -119,7 +116,7 @@ def get_weather(params: WeatherParams) -> dict: |
119 | 116 |
|
120 | 117 | # Send request with automatic tool execution |
121 | 118 | response5 = edgee.send( |
122 | | - model="gpt-4o", |
| 119 | + model="devtral2", |
123 | 120 | input="What's the weather like in Paris?", |
124 | 121 | tools=[weather_tool], |
125 | 122 | ) |
@@ -161,7 +158,7 @@ def calculate(params: CalculatorParams) -> dict: |
161 | 158 | ) |
162 | 159 |
|
163 | 160 | response6 = edgee.send( |
164 | | - model="gpt-4o", |
| 161 | + model="devtral2", |
165 | 162 | input="What's 25 multiplied by 4, and then what's the weather in London?", |
166 | 163 | tools=[weather_tool, calculator_tool], |
167 | 164 | ) |
|
0 commit comments