Skip to content

Commit 1ecd83b

Browse files
#133 conflict solved
2 parents 74694c3 + 582c14e commit 1ecd83b

27 files changed

+1090
-316
lines changed

docs/en/sgr-api/SGR-Description-API.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Create a chat completion for research tasks. This is the main endpoint for inter
112112
**Parameters:**
113113

114114
- `model` (string, required): Agent type or existing agent ID
115-
- `messages` (array, required): List of chat messages
115+
- `messages` (array, required): List of chat messages in OpenAI format (ChatCompletionMessageParam)
116116
- `stream` (boolean, default: true): Enable streaming mode
117117
- `max_tokens` (integer, optional): Maximum number of tokens
118118
- `temperature` (float, optional): Generation temperature (0.0-1.0)
@@ -140,6 +140,44 @@ curl -X POST "http://localhost:8010/v1/chat/completions" \
140140
}'
141141
```
142142

143+
**Example with Image (URL):**
144+
145+
```bash
146+
curl -X POST "http://localhost:8010/v1/chat/completions" \
147+
-H "Content-Type: application/json" \
148+
-d '{
149+
"model": "sgr-agent",
150+
"messages": [{
151+
"role": "user",
152+
"content": [
153+
{"type": "text", "text": "Analyze this chart and research the trends"},
154+
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
155+
]
156+
}],
157+
"stream": true
158+
}'
159+
```
160+
161+
**Example with Image (Base64):**
162+
163+
```bash
164+
curl -X POST "http://localhost:8010/v1/chat/completions" \
165+
-H "Content-Type: application/json" \
166+
-d '{
167+
"model": "sgr-agent",
168+
"messages": [{
169+
"role": "user",
170+
"content": [
171+
{"type": "text", "text": "What is shown in this image?"},
172+
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."}}
173+
]
174+
}],
175+
"stream": true
176+
}'
177+
```
178+
179+
**Note:** Base64 image URLs longer than 200 characters will be truncated in responses for performance reasons.
180+
143181
</details>
144182

145183
______________________________________________________________________
@@ -158,7 +196,12 @@ Get a list of all active agents.
158196
"agents": [
159197
{
160198
"agent_id": "sgr_agent_12345-67890-abcdef",
161-
"task": "Research BMW X6 2025 prices",
199+
"task_messages": [
200+
{
201+
"role": "user",
202+
"content": "Research BMW X6 2025 prices"
203+
}
204+
],
162205
"state": "RESEARCHING"
163206
}
164207
],
@@ -195,7 +238,12 @@ Get detailed state information for a specific agent.
195238
```json
196239
{
197240
"agent_id": "sgr_agent_12345-67890-abcdef",
198-
"task": "Research BMW X6 2025 prices",
241+
"task_messages": [
242+
{
243+
"role": "user",
244+
"content": "Research BMW X6 2025 prices"
245+
}
246+
],
199247
"state": "RESEARCHING",
200248
"iteration": 3,
201249
"searches_used": 2,
@@ -234,14 +282,19 @@ Provide clarification to an agent that is waiting for input.
234282

235283
```json
236284
{
237-
"clarifications": "Focus on luxury models only, price range 5-8 million rubles"
285+
"messages": [
286+
{
287+
"role": "user",
288+
"content": "Focus on luxury models only, price range 5-8 million rubles"
289+
}
290+
]
238291
}
239292
```
240293

241294
**Parameters:**
242295

243296
- `agent_id` (string, required): Unique agent identifier
244-
- `clarifications` (string, required): Clarification text
297+
- `messages` (array, required): Clarification messages in OpenAI format (ChatCompletionMessageParam)
245298

246299
**Response:**
247300
Streaming response with continued research after clarification.
@@ -252,7 +305,7 @@ Streaming response with continued research after clarification.
252305
curl -X POST "http://localhost:8010/agents/sgr_agent_12345-67890-abcdef/provide_clarification" \
253306
-H "Content-Type: application/json" \
254307
-d '{
255-
"clarifications": "Focus on luxury models only"
308+
"messages": [{"role": "user", "content": "Focus on luxury models only"}]
256309
}'
257310
```
258311

docs/en/sgr-api/SGR-Integration-&-Examples.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,45 @@ if clarification_questions and agent_id:
101101
print("\n\nResearch completed!")
102102
```
103103

104+
### Example 3: Research Request with Image
105+
106+
Send a research request with a local image file attachment.
107+
108+
```python
109+
import base64
110+
from openai import OpenAI
111+
112+
client = OpenAI(base_url="http://localhost:8010/v1", api_key="dummy")
113+
114+
# Read local image file and encode to base64
115+
with open("chart.png", "rb") as image_file:
116+
image_data = base64.b64encode(image_file.read()).decode("utf-8")
117+
image_base64 = f"data:image/png;base64,{image_data}"
118+
119+
# Research request with local image
120+
response = client.chat.completions.create(
121+
model="sgr-agent",
122+
messages=[{
123+
"role": "user",
124+
"content": [
125+
{"type": "text", "text": "Analyze this chart and research the trends shown"},
126+
{"type": "image_url", "image_url": {"url": image_base64}}
127+
]
128+
}],
129+
stream=True,
130+
temperature=0.4,
131+
)
132+
133+
# Print streaming response
134+
for chunk in response:
135+
if chunk.choices[0].delta.content:
136+
print(chunk.choices[0].delta.content, end="")
137+
```
138+
139+
**Image Formats Supported:**
140+
- Image URLs (HTTP/HTTPS)
141+
- Base64 encoded images (`data:image/jpeg;base64,...` or `data:image/png;base64,...`)
142+
104143
#### Usage Notes
105144

106145
- Replace `localhost:8010` with your server URL

docs/ru/sgr-api/SGR-Description-API.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ ______________________________________________________________________
112112
**Параметры:**
113113

114114
- `model` (string, обязательный): Тип агента или существующий ID агента
115-
- `messages` (array, обязательный): Список сообщений чата
115+
- `messages` (array, обязательный): Список сообщений чата в формате OpenAI (ChatCompletionMessageParam)
116116
- `stream` (boolean, по умолчанию: true): Включить режим потоковой передачи
117117
- `max_tokens` (integer, опциональный): Максимальное количество токенов
118118
- `temperature` (float, опциональный): Температура генерации (0.0-1.0)
@@ -140,6 +140,44 @@ curl -X POST "http://localhost:8010/v1/chat/completions" \
140140
}'
141141
```
142142

143+
**Пример с изображением (URL):**
144+
145+
```bash
146+
curl -X POST "http://localhost:8010/v1/chat/completions" \
147+
-H "Content-Type: application/json" \
148+
-d '{
149+
"model": "sgr-agent",
150+
"messages": [{
151+
"role": "user",
152+
"content": [
153+
{"type": "text", "text": "Проанализируй этот график и исследуй тренды"},
154+
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
155+
]
156+
}],
157+
"stream": true
158+
}'
159+
```
160+
161+
**Пример с изображением (Base64):**
162+
163+
```bash
164+
curl -X POST "http://localhost:8010/v1/chat/completions" \
165+
-H "Content-Type: application/json" \
166+
-d '{
167+
"model": "sgr-agent",
168+
"messages": [{
169+
"role": "user",
170+
"content": [
171+
{"type": "text", "text": "Что показано на этом изображении?"},
172+
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."}}
173+
]
174+
}],
175+
"stream": true
176+
}'
177+
```
178+
179+
**Примечание:** Base64 URL изображений длиннее 200 символов будут обрезаны в ответах для оптимизации производительности.
180+
143181
</details>
144182

145183
______________________________________________________________________
@@ -158,7 +196,12 @@ ______________________________________________________________________
158196
"agents": [
159197
{
160198
"agent_id": "sgr_agent_12345-67890-abcdef",
161-
"task": "Research BMW X6 2025 prices",
199+
"task_messages": [
200+
{
201+
"role": "user",
202+
"content": "Research BMW X6 2025 prices"
203+
}
204+
],
162205
"state": "RESEARCHING"
163206
}
164207
],
@@ -195,7 +238,12 @@ ______________________________________________________________________
195238
```json
196239
{
197240
"agent_id": "sgr_agent_12345-67890-abcdef",
198-
"task": "Research BMW X6 2025 prices",
241+
"task_messages": [
242+
{
243+
"role": "user",
244+
"content": "Research BMW X6 2025 prices"
245+
}
246+
],
199247
"state": "RESEARCHING",
200248
"iteration": 3,
201249
"searches_used": 2,
@@ -234,14 +282,19 @@ ______________________________________________________________________
234282

235283
```json
236284
{
237-
"clarifications": "Focus on luxury models only, price range 5-8 million rubles"
285+
"messages": [
286+
{
287+
"role": "user",
288+
"content": "Focus on luxury models only, price range 5-8 million rubles"
289+
}
290+
]
238291
}
239292
```
240293

241294
**Параметры:**
242295

243296
- `agent_id` (string, обязательный): Уникальный идентификатор агента
244-
- `clarifications` (string, обязательный): Текст уточнения
297+
- `messages` (array, обязательный): Сообщения уточнения в формате OpenAI (ChatCompletionMessageParam)
245298

246299
**Ответ:**
247300
Потоковый ответ с продолжением исследования после уточнения.
@@ -252,7 +305,7 @@ ______________________________________________________________________
252305
curl -X POST "http://localhost:8010/agents/sgr_agent_12345-67890-abcdef/provide_clarification" \
253306
-H "Content-Type: application/json" \
254307
-d '{
255-
"clarifications": "Focus on luxury models only"
308+
"messages": [{"role": "user", "content": "Focus on luxury models only"}]
256309
}'
257310
```
258311

docs/ru/sgr-api/SGR-Integration-&-Examples.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,45 @@ if clarification_questions and agent_id:
101101
print("\n\nИсследование завершено!")
102102
```
103103

104+
### Пример 3: Исследовательский запрос с изображением
105+
106+
Отправка исследовательского запроса с локальным файлом изображения.
107+
108+
```python
109+
import base64
110+
from openai import OpenAI
111+
112+
client = OpenAI(base_url="http://localhost:8010/v1", api_key="dummy")
113+
114+
# Прочитать локальный файл изображения и закодировать в base64
115+
with open("chart.png", "rb") as image_file:
116+
image_data = base64.b64encode(image_file.read()).decode("utf-8")
117+
image_base64 = f"data:image/png;base64,{image_data}"
118+
119+
# Исследовательский запрос с локальным изображением
120+
response = client.chat.completions.create(
121+
model="sgr-agent",
122+
messages=[{
123+
"role": "user",
124+
"content": [
125+
{"type": "text", "text": "Проанализируй этот график и исследуй показанные тренды"},
126+
{"type": "image_url", "image_url": {"url": image_base64}}
127+
]
128+
}],
129+
stream=True,
130+
temperature=0.4,
131+
)
132+
133+
# Вывести потоковый ответ
134+
for chunk in response:
135+
if chunk.choices[0].delta.content:
136+
print(chunk.choices[0].delta.content, end="")
137+
```
138+
139+
**Поддерживаемые форматы изображений:**
140+
- URL изображений (HTTP/HTTPS)
141+
- Изображения в формате Base64 (`data:image/jpeg;base64,...` или `data:image/png;base64,...`)
142+
104143
#### Примечания по использованию
105144

106145
- Замените `localhost:8010` на URL вашего сервера

0 commit comments

Comments
 (0)