Skip to content

Commit a596f21

Browse files
committed
chore: readme design
1 parent 6c1396e commit a596f21

1 file changed

Lines changed: 40 additions & 115 deletions

File tree

README.md

Lines changed: 40 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,83 @@
1-
# Edgee Gateway SDK
1+
# Edgee Python SDK
22

3-
Lightweight Python SDK for Edgee AI Gateway.
3+
Lightweight, type-safe Python SDK for the [Edgee AI Gateway](https://www.edgee.cloud).
4+
5+
[![PyPI version](https://img.shields.io/pypi/v/edgee.svg)]( )
6+
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
47

58
## Installation
69

710
```bash
811
pip install edgee
912
```
1013

11-
## Usage
14+
## Quick Start
1215

1316
```python
1417
from edgee import Edgee
1518

16-
edgee = Edgee(os.environ.get("EDGEE_API_KEY"))
17-
```
18-
19-
### Simple Input
19+
edgee = Edgee("your-api-key")
2020

21-
```python
21+
# Send a simple request
2222
response = edgee.send(
2323
model="gpt-4o",
24-
input="What is the capital of France?",
24+
input="What is the capital of France?"
2525
)
2626

2727
print(response.text)
28+
# "The capital of France is Paris."
2829
```
2930

30-
### Full Input with Messages
31+
## Send Method
3132

32-
```python
33-
response = edgee.send(
34-
model="gpt-4o",
35-
input={
36-
"messages": [
37-
{"role": "system", "content": "You are a helpful assistant."},
38-
{"role": "user", "content": "Hello!"},
39-
],
40-
},
41-
)
42-
```
43-
44-
### With Tools
33+
The `send()` method makes non-streaming chat completion requests:
4534

4635
```python
4736
response = edgee.send(
4837
model="gpt-4o",
49-
input={
50-
"messages": [{"role": "user", "content": "What's the weather in Paris?"}],
51-
"tools": [
52-
{
53-
"type": "function",
54-
"function": {
55-
"name": "get_weather",
56-
"description": "Get weather for a location",
57-
"parameters": {
58-
"type": "object",
59-
"properties": {
60-
"location": {"type": "string"},
61-
},
62-
},
63-
},
64-
},
65-
],
66-
"tool_choice": "auto",
67-
},
38+
input="Hello, world!"
6839
)
6940

70-
if response.tool_calls:
71-
print(response.tool_calls)
41+
# Access response
42+
print(response.text) # Text content
43+
print(response.finish_reason) # Finish reason
44+
print(response.tool_calls) # Tool calls (if any)
7245
```
7346

74-
### Streaming
75-
76-
Access chunk properties for streaming:
77-
78-
```python
79-
for chunk in edgee.stream(model="gpt-4o", input="Tell me a story"):
80-
if chunk.text:
81-
print(chunk.text, end="", flush=True)
82-
```
47+
## Stream Method
8348

84-
#### Alternative: Using send(stream=True)
49+
The `stream()` method enables real-time streaming responses:
8550

8651
```python
87-
for chunk in edgee.send(model="gpt-4o", input="Tell me a story", stream=True):
52+
for chunk in edgee.stream("gpt-4o", "Tell me a story"):
8853
if chunk.text:
8954
print(chunk.text, end="", flush=True)
55+
56+
if chunk.finish_reason:
57+
print(f"\nFinished: {chunk.finish_reason}")
9058
```
9159

92-
#### Accessing Full Chunk Data
60+
## Features
9361

94-
When you need complete access to the streaming response:
62+
-**Type-safe** - Full type hints with dataclasses
63+
-**OpenAI-compatible** - Works with any model supported by Edgee
64+
-**Streaming** - Real-time response streaming with generators
65+
-**Tool calling** - Full support for function calling
66+
-**Flexible input** - Accept strings, dicts, or InputObject
67+
-**Zero dependencies** - Uses only Python standard library
9568

96-
```python
97-
for chunk in edgee.stream(model="gpt-4o", input="Hello"):
98-
if chunk.role:
99-
print(f"Role: {chunk.role}")
100-
if chunk.text:
101-
print(chunk.text, end="", flush=True)
102-
if chunk.finish_reason:
103-
print(f"\nFinish: {chunk.finish_reason}")
104-
```
69+
## Documentation
10570

106-
## Response
71+
For complete documentation, examples, and API reference, visit:
10772

108-
```python
109-
@dataclass
110-
class SendResponse:
111-
choices: list[Choice]
112-
usage: Optional[Usage]
113-
114-
# Convenience properties for easy access
115-
text: str | None # Shortcut for choices[0].message["content"]
116-
message: dict | None # Shortcut for choices[0].message
117-
finish_reason: str | None # Shortcut for choices[0].finish_reason
118-
tool_calls: list | None # Shortcut for choices[0].message["tool_calls"]
119-
120-
@dataclass
121-
class Choice:
122-
index: int
123-
message: dict # {"role": str, "content": str | None, "tool_calls": list | None}
124-
finish_reason: str | None
125-
126-
@dataclass
127-
class Usage:
128-
prompt_tokens: int
129-
completion_tokens: int
130-
total_tokens: int
131-
```
73+
**👉 [Official Python SDK Documentation](https://www.edgee.cloud/docs/sdk/python)**
13274

133-
### Streaming Response
75+
The documentation includes:
76+
- [Configuration guide](https://www.edgee.cloud/docs/sdk/python/configuration) - Multiple ways to configure the SDK
77+
- [Send method](https://www.edgee.cloud/docs/sdk/python/send) - Complete guide to non-streaming requests
78+
- [Stream method](https://www.edgee.cloud/docs/sdk/python/stream) - Streaming responses guide
79+
- [Tools](https://www.edgee.cloud/docs/sdk/python/tools) - Function calling guide
13480

135-
```python
136-
@dataclass
137-
class StreamChunk:
138-
choices: list[StreamChoice]
139-
140-
# Convenience properties for easy access
141-
text: str | None # Shortcut for choices[0].delta.content
142-
role: str | None # Shortcut for choices[0].delta.role
143-
finish_reason: str | None # Shortcut for choices[0].finish_reason
144-
145-
@dataclass
146-
class StreamChoice:
147-
index: int
148-
delta: StreamDelta
149-
finish_reason: str | None
150-
151-
@dataclass
152-
class StreamDelta:
153-
role: str | None # Only present in first chunk
154-
content: str | None
155-
tool_calls: list[dict] | None
156-
```
81+
## License
15782

158-
To learn more about this SDK, please refer to the [dedicated documentation](https://www.edgee.cloud/docs/sdk/python).
83+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)