mbxai 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mbxai-0.5.0/.vscode/PythonImportHelper-v2-Completion.json +1389 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/PKG-INFO +1 -1
- {mbxai-0.3.0 → mbxai-0.5.0}/pyproject.toml +1 -1
- {mbxai-0.3.0 → mbxai-0.5.0}/setup.py +1 -1
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/__init__.py +1 -1
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/mcp/client.py +28 -10
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/mcp/server.py +2 -9
- {mbxai-0.3.0 → mbxai-0.5.0}/uv.lock +7 -7
- {mbxai-0.3.0 → mbxai-0.5.0}/LICENSE +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/README.md +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/core.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/mcp/__init__.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/mcp/example.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/openrouter/__init__.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/openrouter/client.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/openrouter/config.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/openrouter/models.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/tools/__init__.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/tools/client.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/tools/example.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/src/mbxai/tools/types.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/tests/test_core.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/tests/test_mcp.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/tests/test_openrouter.py +0 -0
- {mbxai-0.3.0 → mbxai-0.5.0}/tests/test_tools.py +0 -0
@@ -0,0 +1,1389 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"label": "runpy",
|
4
|
+
"kind": 6,
|
5
|
+
"isExtraImport": true,
|
6
|
+
"importPath": "runpy",
|
7
|
+
"description": "runpy",
|
8
|
+
"detail": "runpy",
|
9
|
+
"documentation": {}
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"label": "annotations",
|
13
|
+
"importPath": "__future__",
|
14
|
+
"description": "__future__",
|
15
|
+
"isExtraImport": true,
|
16
|
+
"detail": "__future__",
|
17
|
+
"documentation": {}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"label": "os",
|
21
|
+
"kind": 6,
|
22
|
+
"isExtraImport": true,
|
23
|
+
"importPath": "os",
|
24
|
+
"description": "os",
|
25
|
+
"detail": "os",
|
26
|
+
"documentation": {}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"label": "site",
|
30
|
+
"kind": 6,
|
31
|
+
"isExtraImport": true,
|
32
|
+
"importPath": "site",
|
33
|
+
"description": "site",
|
34
|
+
"detail": "site",
|
35
|
+
"documentation": {}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"label": "sys",
|
39
|
+
"kind": 6,
|
40
|
+
"isExtraImport": true,
|
41
|
+
"importPath": "sys",
|
42
|
+
"description": "sys",
|
43
|
+
"detail": "sys",
|
44
|
+
"documentation": {}
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"label": "Any",
|
48
|
+
"importPath": "typing",
|
49
|
+
"description": "typing",
|
50
|
+
"isExtraImport": true,
|
51
|
+
"detail": "typing",
|
52
|
+
"documentation": {}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"label": "TypeVar",
|
56
|
+
"importPath": "typing",
|
57
|
+
"description": "typing",
|
58
|
+
"isExtraImport": true,
|
59
|
+
"detail": "typing",
|
60
|
+
"documentation": {}
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"label": "Callable",
|
64
|
+
"importPath": "typing",
|
65
|
+
"description": "typing",
|
66
|
+
"isExtraImport": true,
|
67
|
+
"detail": "typing",
|
68
|
+
"documentation": {}
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"label": "Any",
|
72
|
+
"importPath": "typing",
|
73
|
+
"description": "typing",
|
74
|
+
"isExtraImport": true,
|
75
|
+
"detail": "typing",
|
76
|
+
"documentation": {}
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"label": "Any",
|
80
|
+
"importPath": "typing",
|
81
|
+
"description": "typing",
|
82
|
+
"isExtraImport": true,
|
83
|
+
"detail": "typing",
|
84
|
+
"documentation": {}
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"label": "Callable",
|
88
|
+
"importPath": "typing",
|
89
|
+
"description": "typing",
|
90
|
+
"isExtraImport": true,
|
91
|
+
"detail": "typing",
|
92
|
+
"documentation": {}
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"label": "TypeVar",
|
96
|
+
"importPath": "typing",
|
97
|
+
"description": "typing",
|
98
|
+
"isExtraImport": true,
|
99
|
+
"detail": "typing",
|
100
|
+
"documentation": {}
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"label": "Any",
|
104
|
+
"importPath": "typing",
|
105
|
+
"description": "typing",
|
106
|
+
"isExtraImport": true,
|
107
|
+
"detail": "typing",
|
108
|
+
"documentation": {}
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"label": "Optional",
|
112
|
+
"importPath": "typing",
|
113
|
+
"description": "typing",
|
114
|
+
"isExtraImport": true,
|
115
|
+
"detail": "typing",
|
116
|
+
"documentation": {}
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"label": "Union",
|
120
|
+
"importPath": "typing",
|
121
|
+
"description": "typing",
|
122
|
+
"isExtraImport": true,
|
123
|
+
"detail": "typing",
|
124
|
+
"documentation": {}
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"label": "Union",
|
128
|
+
"importPath": "typing",
|
129
|
+
"description": "typing",
|
130
|
+
"isExtraImport": true,
|
131
|
+
"detail": "typing",
|
132
|
+
"documentation": {}
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"label": "ClassVar",
|
136
|
+
"importPath": "typing",
|
137
|
+
"description": "typing",
|
138
|
+
"isExtraImport": true,
|
139
|
+
"detail": "typing",
|
140
|
+
"documentation": {}
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"label": "Any",
|
144
|
+
"importPath": "typing",
|
145
|
+
"description": "typing",
|
146
|
+
"isExtraImport": true,
|
147
|
+
"detail": "typing",
|
148
|
+
"documentation": {}
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"label": "Callable",
|
152
|
+
"importPath": "typing",
|
153
|
+
"description": "typing",
|
154
|
+
"isExtraImport": true,
|
155
|
+
"detail": "typing",
|
156
|
+
"documentation": {}
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"label": "TypeVar",
|
160
|
+
"importPath": "typing",
|
161
|
+
"description": "typing",
|
162
|
+
"isExtraImport": true,
|
163
|
+
"detail": "typing",
|
164
|
+
"documentation": {}
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"label": "cast",
|
168
|
+
"importPath": "typing",
|
169
|
+
"description": "typing",
|
170
|
+
"isExtraImport": true,
|
171
|
+
"detail": "typing",
|
172
|
+
"documentation": {}
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"label": "Any",
|
176
|
+
"importPath": "typing",
|
177
|
+
"description": "typing",
|
178
|
+
"isExtraImport": true,
|
179
|
+
"detail": "typing",
|
180
|
+
"documentation": {}
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"label": "Callable",
|
184
|
+
"importPath": "typing",
|
185
|
+
"description": "typing",
|
186
|
+
"isExtraImport": true,
|
187
|
+
"detail": "typing",
|
188
|
+
"documentation": {}
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"label": "TypedDict",
|
192
|
+
"importPath": "typing",
|
193
|
+
"description": "typing",
|
194
|
+
"isExtraImport": true,
|
195
|
+
"detail": "typing",
|
196
|
+
"documentation": {}
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"label": "NotRequired",
|
200
|
+
"importPath": "typing",
|
201
|
+
"description": "typing",
|
202
|
+
"isExtraImport": true,
|
203
|
+
"detail": "typing",
|
204
|
+
"documentation": {}
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"label": "Any",
|
208
|
+
"importPath": "typing",
|
209
|
+
"description": "typing",
|
210
|
+
"isExtraImport": true,
|
211
|
+
"detail": "typing",
|
212
|
+
"documentation": {}
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"label": "httpx",
|
216
|
+
"kind": 6,
|
217
|
+
"isExtraImport": true,
|
218
|
+
"importPath": "httpx",
|
219
|
+
"description": "httpx",
|
220
|
+
"detail": "httpx",
|
221
|
+
"documentation": {}
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"label": "logging",
|
225
|
+
"kind": 6,
|
226
|
+
"isExtraImport": true,
|
227
|
+
"importPath": "logging",
|
228
|
+
"description": "logging",
|
229
|
+
"detail": "logging",
|
230
|
+
"documentation": {}
|
231
|
+
},
|
232
|
+
{
|
233
|
+
"label": "BaseModel",
|
234
|
+
"importPath": "pydantic",
|
235
|
+
"description": "pydantic",
|
236
|
+
"isExtraImport": true,
|
237
|
+
"detail": "pydantic",
|
238
|
+
"documentation": {}
|
239
|
+
},
|
240
|
+
{
|
241
|
+
"label": "Field",
|
242
|
+
"importPath": "pydantic",
|
243
|
+
"description": "pydantic",
|
244
|
+
"isExtraImport": true,
|
245
|
+
"detail": "pydantic",
|
246
|
+
"documentation": {}
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"label": "BaseModel",
|
250
|
+
"importPath": "pydantic",
|
251
|
+
"description": "pydantic",
|
252
|
+
"isExtraImport": true,
|
253
|
+
"detail": "pydantic",
|
254
|
+
"documentation": {}
|
255
|
+
},
|
256
|
+
{
|
257
|
+
"label": "BaseModel",
|
258
|
+
"importPath": "pydantic",
|
259
|
+
"description": "pydantic",
|
260
|
+
"isExtraImport": true,
|
261
|
+
"detail": "pydantic",
|
262
|
+
"documentation": {}
|
263
|
+
},
|
264
|
+
{
|
265
|
+
"label": "Field",
|
266
|
+
"importPath": "pydantic",
|
267
|
+
"description": "pydantic",
|
268
|
+
"isExtraImport": true,
|
269
|
+
"detail": "pydantic",
|
270
|
+
"documentation": {}
|
271
|
+
},
|
272
|
+
{
|
273
|
+
"label": "ConfigDict",
|
274
|
+
"importPath": "pydantic",
|
275
|
+
"description": "pydantic",
|
276
|
+
"isExtraImport": true,
|
277
|
+
"detail": "pydantic",
|
278
|
+
"documentation": {}
|
279
|
+
},
|
280
|
+
{
|
281
|
+
"label": "BaseModel",
|
282
|
+
"importPath": "pydantic",
|
283
|
+
"description": "pydantic",
|
284
|
+
"isExtraImport": true,
|
285
|
+
"detail": "pydantic",
|
286
|
+
"documentation": {}
|
287
|
+
},
|
288
|
+
{
|
289
|
+
"label": "TypeAdapter",
|
290
|
+
"importPath": "pydantic",
|
291
|
+
"description": "pydantic",
|
292
|
+
"isExtraImport": true,
|
293
|
+
"detail": "pydantic",
|
294
|
+
"documentation": {}
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"label": "BaseModel",
|
298
|
+
"importPath": "pydantic",
|
299
|
+
"description": "pydantic",
|
300
|
+
"isExtraImport": true,
|
301
|
+
"detail": "pydantic",
|
302
|
+
"documentation": {}
|
303
|
+
},
|
304
|
+
{
|
305
|
+
"label": "Field",
|
306
|
+
"importPath": "pydantic",
|
307
|
+
"description": "pydantic",
|
308
|
+
"isExtraImport": true,
|
309
|
+
"detail": "pydantic",
|
310
|
+
"documentation": {}
|
311
|
+
},
|
312
|
+
{
|
313
|
+
"label": "field_validator",
|
314
|
+
"importPath": "pydantic",
|
315
|
+
"description": "pydantic",
|
316
|
+
"isExtraImport": true,
|
317
|
+
"detail": "pydantic",
|
318
|
+
"documentation": {}
|
319
|
+
},
|
320
|
+
{
|
321
|
+
"label": "BaseModel",
|
322
|
+
"importPath": "pydantic",
|
323
|
+
"description": "pydantic",
|
324
|
+
"isExtraImport": true,
|
325
|
+
"detail": "pydantic",
|
326
|
+
"documentation": {}
|
327
|
+
},
|
328
|
+
{
|
329
|
+
"label": "BaseModel",
|
330
|
+
"importPath": "pydantic",
|
331
|
+
"description": "pydantic",
|
332
|
+
"isExtraImport": true,
|
333
|
+
"detail": "pydantic",
|
334
|
+
"documentation": {}
|
335
|
+
},
|
336
|
+
{
|
337
|
+
"label": "BaseModel",
|
338
|
+
"importPath": "pydantic",
|
339
|
+
"description": "pydantic",
|
340
|
+
"isExtraImport": true,
|
341
|
+
"detail": "pydantic",
|
342
|
+
"documentation": {}
|
343
|
+
},
|
344
|
+
{
|
345
|
+
"label": "BaseModel",
|
346
|
+
"importPath": "pydantic",
|
347
|
+
"description": "pydantic",
|
348
|
+
"isExtraImport": true,
|
349
|
+
"detail": "pydantic",
|
350
|
+
"documentation": {}
|
351
|
+
},
|
352
|
+
{
|
353
|
+
"label": "ValidationError",
|
354
|
+
"importPath": "pydantic",
|
355
|
+
"description": "pydantic",
|
356
|
+
"isExtraImport": true,
|
357
|
+
"detail": "pydantic",
|
358
|
+
"documentation": {}
|
359
|
+
},
|
360
|
+
{
|
361
|
+
"label": "BaseModel",
|
362
|
+
"importPath": "pydantic",
|
363
|
+
"description": "pydantic",
|
364
|
+
"isExtraImport": true,
|
365
|
+
"detail": "pydantic",
|
366
|
+
"documentation": {}
|
367
|
+
},
|
368
|
+
{
|
369
|
+
"label": "BaseModel",
|
370
|
+
"importPath": "pydantic",
|
371
|
+
"description": "pydantic",
|
372
|
+
"isExtraImport": true,
|
373
|
+
"detail": "pydantic",
|
374
|
+
"documentation": {}
|
375
|
+
},
|
376
|
+
{
|
377
|
+
"label": "asyncio",
|
378
|
+
"kind": 6,
|
379
|
+
"isExtraImport": true,
|
380
|
+
"importPath": "asyncio",
|
381
|
+
"description": "asyncio",
|
382
|
+
"detail": "asyncio",
|
383
|
+
"documentation": {}
|
384
|
+
},
|
385
|
+
{
|
386
|
+
"label": "FastMCP",
|
387
|
+
"importPath": "mcp.server.fastmcp",
|
388
|
+
"description": "mcp.server.fastmcp",
|
389
|
+
"isExtraImport": true,
|
390
|
+
"detail": "mcp.server.fastmcp",
|
391
|
+
"documentation": {}
|
392
|
+
},
|
393
|
+
{
|
394
|
+
"label": "FastMCP",
|
395
|
+
"importPath": "mcp.server.fastmcp",
|
396
|
+
"description": "mcp.server.fastmcp",
|
397
|
+
"isExtraImport": true,
|
398
|
+
"detail": "mcp.server.fastmcp",
|
399
|
+
"documentation": {}
|
400
|
+
},
|
401
|
+
{
|
402
|
+
"label": "FastMCP",
|
403
|
+
"importPath": "mcp.server.fastmcp",
|
404
|
+
"description": "mcp.server.fastmcp",
|
405
|
+
"isExtraImport": true,
|
406
|
+
"detail": "mcp.server.fastmcp",
|
407
|
+
"documentation": {}
|
408
|
+
},
|
409
|
+
{
|
410
|
+
"label": "FastAPI",
|
411
|
+
"importPath": "fastapi",
|
412
|
+
"description": "fastapi",
|
413
|
+
"isExtraImport": true,
|
414
|
+
"detail": "fastapi",
|
415
|
+
"documentation": {}
|
416
|
+
},
|
417
|
+
{
|
418
|
+
"label": "Body",
|
419
|
+
"importPath": "fastapi",
|
420
|
+
"description": "fastapi",
|
421
|
+
"isExtraImport": true,
|
422
|
+
"detail": "fastapi",
|
423
|
+
"documentation": {}
|
424
|
+
},
|
425
|
+
{
|
426
|
+
"label": "OpenAI",
|
427
|
+
"importPath": "openai",
|
428
|
+
"description": "openai",
|
429
|
+
"isExtraImport": true,
|
430
|
+
"detail": "openai",
|
431
|
+
"documentation": {}
|
432
|
+
},
|
433
|
+
{
|
434
|
+
"label": "OpenAIError",
|
435
|
+
"importPath": "openai",
|
436
|
+
"description": "openai",
|
437
|
+
"isExtraImport": true,
|
438
|
+
"detail": "openai",
|
439
|
+
"documentation": {}
|
440
|
+
},
|
441
|
+
{
|
442
|
+
"label": "Enum",
|
443
|
+
"importPath": "enum",
|
444
|
+
"description": "enum",
|
445
|
+
"isExtraImport": true,
|
446
|
+
"detail": "enum",
|
447
|
+
"documentation": {}
|
448
|
+
},
|
449
|
+
{
|
450
|
+
"label": "hello_world",
|
451
|
+
"importPath": "mbxai.core",
|
452
|
+
"description": "mbxai.core",
|
453
|
+
"isExtraImport": true,
|
454
|
+
"detail": "mbxai.core",
|
455
|
+
"documentation": {}
|
456
|
+
},
|
457
|
+
{
|
458
|
+
"label": "pytest",
|
459
|
+
"kind": 6,
|
460
|
+
"isExtraImport": true,
|
461
|
+
"importPath": "pytest",
|
462
|
+
"description": "pytest",
|
463
|
+
"detail": "pytest",
|
464
|
+
"documentation": {}
|
465
|
+
},
|
466
|
+
{
|
467
|
+
"label": "Mock",
|
468
|
+
"importPath": "unittest.mock",
|
469
|
+
"description": "unittest.mock",
|
470
|
+
"isExtraImport": true,
|
471
|
+
"detail": "unittest.mock",
|
472
|
+
"documentation": {}
|
473
|
+
},
|
474
|
+
{
|
475
|
+
"label": "patch",
|
476
|
+
"importPath": "unittest.mock",
|
477
|
+
"description": "unittest.mock",
|
478
|
+
"isExtraImport": true,
|
479
|
+
"detail": "unittest.mock",
|
480
|
+
"documentation": {}
|
481
|
+
},
|
482
|
+
{
|
483
|
+
"label": "AsyncMock",
|
484
|
+
"importPath": "unittest.mock",
|
485
|
+
"description": "unittest.mock",
|
486
|
+
"isExtraImport": true,
|
487
|
+
"detail": "unittest.mock",
|
488
|
+
"documentation": {}
|
489
|
+
},
|
490
|
+
{
|
491
|
+
"label": "patch",
|
492
|
+
"importPath": "unittest.mock",
|
493
|
+
"description": "unittest.mock",
|
494
|
+
"isExtraImport": true,
|
495
|
+
"detail": "unittest.mock",
|
496
|
+
"documentation": {}
|
497
|
+
},
|
498
|
+
{
|
499
|
+
"label": "MagicMock",
|
500
|
+
"importPath": "unittest.mock",
|
501
|
+
"description": "unittest.mock",
|
502
|
+
"isExtraImport": true,
|
503
|
+
"detail": "unittest.mock",
|
504
|
+
"documentation": {}
|
505
|
+
},
|
506
|
+
{
|
507
|
+
"label": "Mock",
|
508
|
+
"importPath": "unittest.mock",
|
509
|
+
"description": "unittest.mock",
|
510
|
+
"isExtraImport": true,
|
511
|
+
"detail": "unittest.mock",
|
512
|
+
"documentation": {}
|
513
|
+
},
|
514
|
+
{
|
515
|
+
"label": "patch",
|
516
|
+
"importPath": "unittest.mock",
|
517
|
+
"description": "unittest.mock",
|
518
|
+
"isExtraImport": true,
|
519
|
+
"detail": "unittest.mock",
|
520
|
+
"documentation": {}
|
521
|
+
},
|
522
|
+
{
|
523
|
+
"label": "TestClient",
|
524
|
+
"importPath": "fastapi.testclient",
|
525
|
+
"description": "fastapi.testclient",
|
526
|
+
"isExtraImport": true,
|
527
|
+
"detail": "fastapi.testclient",
|
528
|
+
"documentation": {}
|
529
|
+
},
|
530
|
+
{
|
531
|
+
"label": "json",
|
532
|
+
"kind": 6,
|
533
|
+
"isExtraImport": true,
|
534
|
+
"importPath": "json",
|
535
|
+
"description": "json",
|
536
|
+
"detail": "json",
|
537
|
+
"documentation": {}
|
538
|
+
},
|
539
|
+
{
|
540
|
+
"label": "MCPClient",
|
541
|
+
"importPath": "mbxai.mcp",
|
542
|
+
"description": "mbxai.mcp",
|
543
|
+
"isExtraImport": true,
|
544
|
+
"detail": "mbxai.mcp",
|
545
|
+
"documentation": {}
|
546
|
+
},
|
547
|
+
{
|
548
|
+
"label": "MCPServer",
|
549
|
+
"importPath": "mbxai.mcp",
|
550
|
+
"description": "mbxai.mcp",
|
551
|
+
"isExtraImport": true,
|
552
|
+
"detail": "mbxai.mcp",
|
553
|
+
"documentation": {}
|
554
|
+
},
|
555
|
+
{
|
556
|
+
"label": "MCPTool",
|
557
|
+
"importPath": "mbxai.mcp.client",
|
558
|
+
"description": "mbxai.mcp.client",
|
559
|
+
"isExtraImport": true,
|
560
|
+
"detail": "mbxai.mcp.client",
|
561
|
+
"documentation": {}
|
562
|
+
},
|
563
|
+
{
|
564
|
+
"label": "OpenRouterClient",
|
565
|
+
"importPath": "mbxai.openrouter",
|
566
|
+
"description": "mbxai.openrouter",
|
567
|
+
"isExtraImport": true,
|
568
|
+
"detail": "mbxai.openrouter",
|
569
|
+
"documentation": {}
|
570
|
+
},
|
571
|
+
{
|
572
|
+
"label": "OpenRouterClient",
|
573
|
+
"importPath": "mbxai.openrouter",
|
574
|
+
"description": "mbxai.openrouter",
|
575
|
+
"isExtraImport": true,
|
576
|
+
"detail": "mbxai.openrouter",
|
577
|
+
"documentation": {}
|
578
|
+
},
|
579
|
+
{
|
580
|
+
"label": "OpenRouterConfig",
|
581
|
+
"importPath": "mbxai.openrouter",
|
582
|
+
"description": "mbxai.openrouter",
|
583
|
+
"isExtraImport": true,
|
584
|
+
"detail": "mbxai.openrouter",
|
585
|
+
"documentation": {}
|
586
|
+
},
|
587
|
+
{
|
588
|
+
"label": "OpenRouterClient",
|
589
|
+
"importPath": "mbxai.openrouter",
|
590
|
+
"description": "mbxai.openrouter",
|
591
|
+
"isExtraImport": true,
|
592
|
+
"detail": "mbxai.openrouter",
|
593
|
+
"documentation": {}
|
594
|
+
},
|
595
|
+
{
|
596
|
+
"label": "OpenRouterModel",
|
597
|
+
"importPath": "mbxai.openrouter",
|
598
|
+
"description": "mbxai.openrouter",
|
599
|
+
"isExtraImport": true,
|
600
|
+
"detail": "mbxai.openrouter",
|
601
|
+
"documentation": {}
|
602
|
+
},
|
603
|
+
{
|
604
|
+
"label": "load_dotenv",
|
605
|
+
"importPath": "dotenv",
|
606
|
+
"description": "dotenv",
|
607
|
+
"isExtraImport": true,
|
608
|
+
"detail": "dotenv",
|
609
|
+
"documentation": {}
|
610
|
+
},
|
611
|
+
{
|
612
|
+
"label": "OpenRouterModel",
|
613
|
+
"importPath": "mbxai.openrouter.models",
|
614
|
+
"description": "mbxai.openrouter.models",
|
615
|
+
"isExtraImport": true,
|
616
|
+
"detail": "mbxai.openrouter.models",
|
617
|
+
"documentation": {}
|
618
|
+
},
|
619
|
+
{
|
620
|
+
"label": "ToolClient",
|
621
|
+
"importPath": "mbxai.tools",
|
622
|
+
"description": "mbxai.tools",
|
623
|
+
"isExtraImport": true,
|
624
|
+
"detail": "mbxai.tools",
|
625
|
+
"documentation": {}
|
626
|
+
},
|
627
|
+
{
|
628
|
+
"label": "Tool",
|
629
|
+
"importPath": "mbxai.tools",
|
630
|
+
"description": "mbxai.tools",
|
631
|
+
"isExtraImport": true,
|
632
|
+
"detail": "mbxai.tools",
|
633
|
+
"documentation": {}
|
634
|
+
},
|
635
|
+
{
|
636
|
+
"label": "setup",
|
637
|
+
"importPath": "setuptools",
|
638
|
+
"description": "setuptools",
|
639
|
+
"isExtraImport": true,
|
640
|
+
"detail": "setuptools",
|
641
|
+
"documentation": {}
|
642
|
+
},
|
643
|
+
{
|
644
|
+
"label": "find_packages",
|
645
|
+
"importPath": "setuptools",
|
646
|
+
"description": "setuptools",
|
647
|
+
"isExtraImport": true,
|
648
|
+
"detail": "setuptools",
|
649
|
+
"documentation": {}
|
650
|
+
},
|
651
|
+
{
|
652
|
+
"label": "bin_dir",
|
653
|
+
"kind": 5,
|
654
|
+
"importPath": ".venv.bin.activate_this",
|
655
|
+
"description": ".venv.bin.activate_this",
|
656
|
+
"peekOfCode": "bin_dir = os.path.dirname(abs_file)\nbase = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"mbxai\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))",
|
657
|
+
"detail": ".venv.bin.activate_this",
|
658
|
+
"documentation": {}
|
659
|
+
},
|
660
|
+
{
|
661
|
+
"label": "base",
|
662
|
+
"kind": 5,
|
663
|
+
"importPath": ".venv.bin.activate_this",
|
664
|
+
"description": ".venv.bin.activate_this",
|
665
|
+
"peekOfCode": "base = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"mbxai\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)",
|
666
|
+
"detail": ".venv.bin.activate_this",
|
667
|
+
"documentation": {}
|
668
|
+
},
|
669
|
+
{
|
670
|
+
"label": "os.environ[\"PATH\"]",
|
671
|
+
"kind": 5,
|
672
|
+
"importPath": ".venv.bin.activate_this",
|
673
|
+
"description": ".venv.bin.activate_this",
|
674
|
+
"peekOfCode": "os.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"mbxai\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix",
|
675
|
+
"detail": ".venv.bin.activate_this",
|
676
|
+
"documentation": {}
|
677
|
+
},
|
678
|
+
{
|
679
|
+
"label": "os.environ[\"VIRTUAL_ENV\"]",
|
680
|
+
"kind": 5,
|
681
|
+
"importPath": ".venv.bin.activate_this",
|
682
|
+
"description": ".venv.bin.activate_this",
|
683
|
+
"peekOfCode": "os.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"mbxai\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
684
|
+
"detail": ".venv.bin.activate_this",
|
685
|
+
"documentation": {}
|
686
|
+
},
|
687
|
+
{
|
688
|
+
"label": "os.environ[\"VIRTUAL_ENV_PROMPT\"]",
|
689
|
+
"kind": 5,
|
690
|
+
"importPath": ".venv.bin.activate_this",
|
691
|
+
"description": ".venv.bin.activate_this",
|
692
|
+
"peekOfCode": "os.environ[\"VIRTUAL_ENV_PROMPT\"] = \"mbxai\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
693
|
+
"detail": ".venv.bin.activate_this",
|
694
|
+
"documentation": {}
|
695
|
+
},
|
696
|
+
{
|
697
|
+
"label": "prev_length",
|
698
|
+
"kind": 5,
|
699
|
+
"importPath": ".venv.bin.activate_this",
|
700
|
+
"description": ".venv.bin.activate_this",
|
701
|
+
"peekOfCode": "prev_length = len(sys.path)\nfor lib in \"../lib/python3.12/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
702
|
+
"detail": ".venv.bin.activate_this",
|
703
|
+
"documentation": {}
|
704
|
+
},
|
705
|
+
{
|
706
|
+
"label": "sys.path[:]",
|
707
|
+
"kind": 5,
|
708
|
+
"importPath": ".venv.bin.activate_this",
|
709
|
+
"description": ".venv.bin.activate_this",
|
710
|
+
"peekOfCode": "sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
711
|
+
"detail": ".venv.bin.activate_this",
|
712
|
+
"documentation": {}
|
713
|
+
},
|
714
|
+
{
|
715
|
+
"label": "sys.real_prefix",
|
716
|
+
"kind": 5,
|
717
|
+
"importPath": ".venv.bin.activate_this",
|
718
|
+
"description": ".venv.bin.activate_this",
|
719
|
+
"peekOfCode": "sys.real_prefix = sys.prefix\nsys.prefix = base",
|
720
|
+
"detail": ".venv.bin.activate_this",
|
721
|
+
"documentation": {}
|
722
|
+
},
|
723
|
+
{
|
724
|
+
"label": "sys.prefix",
|
725
|
+
"kind": 5,
|
726
|
+
"importPath": ".venv.bin.activate_this",
|
727
|
+
"description": ".venv.bin.activate_this",
|
728
|
+
"peekOfCode": "sys.prefix = base",
|
729
|
+
"detail": ".venv.bin.activate_this",
|
730
|
+
"documentation": {}
|
731
|
+
},
|
732
|
+
{
|
733
|
+
"label": "MCPTool",
|
734
|
+
"kind": 6,
|
735
|
+
"importPath": "src.mbxai.mcp.client",
|
736
|
+
"description": "src.mbxai.mcp.client",
|
737
|
+
"peekOfCode": "class MCPTool(Tool):\n \"\"\"MCP tool definition.\"\"\"\n internal_url: str | None = Field(default=None, description=\"The internal URL to invoke the tool\")\n service: str = Field(description=\"The service that provides the tool\")\n strict: bool = Field(default=True, description=\"Whether the tool response is strictly validated\")\n input_schema: dict[str, Any] = Field(description=\"The input schema for the tool\")\n def to_openai_function(self) -> dict[str, Any]:\n \"\"\"Convert the tool to an OpenAI function definition.\"\"\"\n return {\n \"name\": self.name,",
|
738
|
+
"detail": "src.mbxai.mcp.client",
|
739
|
+
"documentation": {}
|
740
|
+
},
|
741
|
+
{
|
742
|
+
"label": "MCPClient",
|
743
|
+
"kind": 6,
|
744
|
+
"importPath": "src.mbxai.mcp.client",
|
745
|
+
"description": "src.mbxai.mcp.client",
|
746
|
+
"peekOfCode": "class MCPClient(ToolClient):\n \"\"\"MCP client that extends ToolClient to support MCP tool servers.\"\"\"\n def __init__(self, openrouter_client: OpenRouterClient):\n \"\"\"Initialize the MCP client.\"\"\"\n super().__init__(openrouter_client)\n self._mcp_servers: dict[str, str] = {}\n self._http_client = httpx.AsyncClient()\n async def __aenter__(self):\n \"\"\"Enter the async context.\"\"\"\n return self",
|
747
|
+
"detail": "src.mbxai.mcp.client",
|
748
|
+
"documentation": {}
|
749
|
+
},
|
750
|
+
{
|
751
|
+
"label": "logger",
|
752
|
+
"kind": 5,
|
753
|
+
"importPath": "src.mbxai.mcp.client",
|
754
|
+
"description": "src.mbxai.mcp.client",
|
755
|
+
"peekOfCode": "logger = logging.getLogger(__name__)\nT = TypeVar(\"T\", bound=BaseModel)\nclass MCPTool(Tool):\n \"\"\"MCP tool definition.\"\"\"\n internal_url: str | None = Field(default=None, description=\"The internal URL to invoke the tool\")\n service: str = Field(description=\"The service that provides the tool\")\n strict: bool = Field(default=True, description=\"Whether the tool response is strictly validated\")\n input_schema: dict[str, Any] = Field(description=\"The input schema for the tool\")\n def to_openai_function(self) -> dict[str, Any]:\n \"\"\"Convert the tool to an OpenAI function definition.\"\"\"",
|
756
|
+
"detail": "src.mbxai.mcp.client",
|
757
|
+
"documentation": {}
|
758
|
+
},
|
759
|
+
{
|
760
|
+
"label": "T",
|
761
|
+
"kind": 5,
|
762
|
+
"importPath": "src.mbxai.mcp.client",
|
763
|
+
"description": "src.mbxai.mcp.client",
|
764
|
+
"peekOfCode": "T = TypeVar(\"T\", bound=BaseModel)\nclass MCPTool(Tool):\n \"\"\"MCP tool definition.\"\"\"\n internal_url: str | None = Field(default=None, description=\"The internal URL to invoke the tool\")\n service: str = Field(description=\"The service that provides the tool\")\n strict: bool = Field(default=True, description=\"Whether the tool response is strictly validated\")\n input_schema: dict[str, Any] = Field(description=\"The input schema for the tool\")\n def to_openai_function(self) -> dict[str, Any]:\n \"\"\"Convert the tool to an OpenAI function definition.\"\"\"\n return {",
|
765
|
+
"detail": "src.mbxai.mcp.client",
|
766
|
+
"documentation": {}
|
767
|
+
},
|
768
|
+
{
|
769
|
+
"label": "WeatherInput",
|
770
|
+
"kind": 6,
|
771
|
+
"importPath": "src.mbxai.mcp.example",
|
772
|
+
"description": "src.mbxai.mcp.example",
|
773
|
+
"peekOfCode": "class WeatherInput(BaseModel):\n location: str\n units: str = \"celsius\" # Default to celsius, can be \"fahrenheit\" or \"celsius\"\nclass WeatherOutput(BaseModel):\n location: str\n temperature: float\n units: str\n condition: str\n humidity: float\n@mcp.tool()",
|
774
|
+
"detail": "src.mbxai.mcp.example",
|
775
|
+
"documentation": {}
|
776
|
+
},
|
777
|
+
{
|
778
|
+
"label": "WeatherOutput",
|
779
|
+
"kind": 6,
|
780
|
+
"importPath": "src.mbxai.mcp.example",
|
781
|
+
"description": "src.mbxai.mcp.example",
|
782
|
+
"peekOfCode": "class WeatherOutput(BaseModel):\n location: str\n temperature: float\n units: str\n condition: str\n humidity: float\n@mcp.tool()\nasync def get_weather(input: WeatherInput) -> dict[str, Any]:\n \"\"\"Get weather information for a location.\n Args:",
|
783
|
+
"detail": "src.mbxai.mcp.example",
|
784
|
+
"documentation": {}
|
785
|
+
},
|
786
|
+
{
|
787
|
+
"label": "mcp",
|
788
|
+
"kind": 5,
|
789
|
+
"importPath": "src.mbxai.mcp.example",
|
790
|
+
"description": "src.mbxai.mcp.example",
|
791
|
+
"peekOfCode": "mcp = FastMCP(\"weather-service\")\n# Define input/output models\nclass WeatherInput(BaseModel):\n location: str\n units: str = \"celsius\" # Default to celsius, can be \"fahrenheit\" or \"celsius\"\nclass WeatherOutput(BaseModel):\n location: str\n temperature: float\n units: str\n condition: str",
|
792
|
+
"detail": "src.mbxai.mcp.example",
|
793
|
+
"documentation": {}
|
794
|
+
},
|
795
|
+
{
|
796
|
+
"label": "Tool",
|
797
|
+
"kind": 6,
|
798
|
+
"importPath": "src.mbxai.mcp.server",
|
799
|
+
"description": "src.mbxai.mcp.server",
|
800
|
+
"peekOfCode": "class Tool(BaseModel):\n \"\"\"MCP tool definition.\"\"\"\n model_config = ConfigDict(strict=True)\n name: str = Field(description=\"The name of the tool\")\n description: str = Field(description=\"The description of what the tool does\")\n input_schema: dict[str, Any] = Field(description=\"The input schema for the tool\")\n strict: bool = Field(default=True, description=\"Whether the tool response is strictly validated\")\n function: Callable[..., Any] = Field(description=\"The tool function\", exclude=True)\nclass MCPServer:\n \"\"\"MCP server implementation.\"\"\"",
|
801
|
+
"detail": "src.mbxai.mcp.server",
|
802
|
+
"documentation": {}
|
803
|
+
},
|
804
|
+
{
|
805
|
+
"label": "MCPServer",
|
806
|
+
"kind": 6,
|
807
|
+
"importPath": "src.mbxai.mcp.server",
|
808
|
+
"description": "src.mbxai.mcp.server",
|
809
|
+
"peekOfCode": "class MCPServer:\n \"\"\"MCP server implementation.\"\"\"\n def __init__(self, name: str, description: str | None = None):\n \"\"\"Initialize the MCP server.\"\"\"\n self.name = name\n self.description = description or f\"A Model Context Protocol (MCP) tool server for {name}\"\n # Create FastAPI app\n self.app = FastAPI(\n title=self.name,\n description=self.description,",
|
810
|
+
"detail": "src.mbxai.mcp.server",
|
811
|
+
"documentation": {}
|
812
|
+
},
|
813
|
+
{
|
814
|
+
"label": "T",
|
815
|
+
"kind": 5,
|
816
|
+
"importPath": "src.mbxai.mcp.server",
|
817
|
+
"description": "src.mbxai.mcp.server",
|
818
|
+
"peekOfCode": "T = TypeVar(\"T\", bound=BaseModel)\nclass Tool(BaseModel):\n \"\"\"MCP tool definition.\"\"\"\n model_config = ConfigDict(strict=True)\n name: str = Field(description=\"The name of the tool\")\n description: str = Field(description=\"The description of what the tool does\")\n input_schema: dict[str, Any] = Field(description=\"The input schema for the tool\")\n strict: bool = Field(default=True, description=\"Whether the tool response is strictly validated\")\n function: Callable[..., Any] = Field(description=\"The tool function\", exclude=True)\nclass MCPServer:",
|
819
|
+
"detail": "src.mbxai.mcp.server",
|
820
|
+
"documentation": {}
|
821
|
+
},
|
822
|
+
{
|
823
|
+
"label": "OpenRouterError",
|
824
|
+
"kind": 6,
|
825
|
+
"importPath": "src.mbxai.openrouter.client",
|
826
|
+
"description": "src.mbxai.openrouter.client",
|
827
|
+
"peekOfCode": "class OpenRouterError(Exception):\n \"\"\"Base exception for OpenRouter client errors.\"\"\"\n pass\nclass OpenRouterConnectionError(OpenRouterError):\n \"\"\"Raised when there is a connection error.\"\"\"\n pass\nclass OpenRouterAPIError(OpenRouterError):\n \"\"\"Raised when the API returns an error.\"\"\"\n pass\nclass OpenRouterClient:",
|
828
|
+
"detail": "src.mbxai.openrouter.client",
|
829
|
+
"documentation": {}
|
830
|
+
},
|
831
|
+
{
|
832
|
+
"label": "OpenRouterConnectionError",
|
833
|
+
"kind": 6,
|
834
|
+
"importPath": "src.mbxai.openrouter.client",
|
835
|
+
"description": "src.mbxai.openrouter.client",
|
836
|
+
"peekOfCode": "class OpenRouterConnectionError(OpenRouterError):\n \"\"\"Raised when there is a connection error.\"\"\"\n pass\nclass OpenRouterAPIError(OpenRouterError):\n \"\"\"Raised when the API returns an error.\"\"\"\n pass\nclass OpenRouterClient:\n \"\"\"Client for interacting with the OpenRouter API.\"\"\"\n def __init__(\n self,",
|
837
|
+
"detail": "src.mbxai.openrouter.client",
|
838
|
+
"documentation": {}
|
839
|
+
},
|
840
|
+
{
|
841
|
+
"label": "OpenRouterAPIError",
|
842
|
+
"kind": 6,
|
843
|
+
"importPath": "src.mbxai.openrouter.client",
|
844
|
+
"description": "src.mbxai.openrouter.client",
|
845
|
+
"peekOfCode": "class OpenRouterAPIError(OpenRouterError):\n \"\"\"Raised when the API returns an error.\"\"\"\n pass\nclass OpenRouterClient:\n \"\"\"Client for interacting with the OpenRouter API.\"\"\"\n def __init__(\n self,\n token: str,\n model: Union[str, OpenRouterModel] = OpenRouterModel.GPT4_TURBO,\n base_url: Optional[str] = None,",
|
846
|
+
"detail": "src.mbxai.openrouter.client",
|
847
|
+
"documentation": {}
|
848
|
+
},
|
849
|
+
{
|
850
|
+
"label": "OpenRouterClient",
|
851
|
+
"kind": 6,
|
852
|
+
"importPath": "src.mbxai.openrouter.client",
|
853
|
+
"description": "src.mbxai.openrouter.client",
|
854
|
+
"peekOfCode": "class OpenRouterClient:\n \"\"\"Client for interacting with the OpenRouter API.\"\"\"\n def __init__(\n self,\n token: str,\n model: Union[str, OpenRouterModel] = OpenRouterModel.GPT4_TURBO,\n base_url: Optional[str] = None,\n default_headers: Optional[dict[str, str]] = None,\n ) -> None:\n \"\"\"Initialize the OpenRouter client.",
|
855
|
+
"detail": "src.mbxai.openrouter.client",
|
856
|
+
"documentation": {}
|
857
|
+
},
|
858
|
+
{
|
859
|
+
"label": "OpenRouterConfig",
|
860
|
+
"kind": 6,
|
861
|
+
"importPath": "src.mbxai.openrouter.config",
|
862
|
+
"description": "src.mbxai.openrouter.config",
|
863
|
+
"peekOfCode": "class OpenRouterConfig(BaseModel):\n \"\"\"Configuration for OpenRouter client.\"\"\"\n token: str = Field(..., description=\"OpenRouter API token\")\n model: Union[str, OpenRouterModel] = Field(\n default=OpenRouterModel.GPT4_TURBO,\n description=\"Model to use for completions\"\n )\n base_url: str = Field(\n default=\"https://openrouter.ai/api/v1\",\n description=\"Base URL for the OpenRouter API\"",
|
864
|
+
"detail": "src.mbxai.openrouter.config",
|
865
|
+
"documentation": {}
|
866
|
+
},
|
867
|
+
{
|
868
|
+
"label": "OpenRouterModel",
|
869
|
+
"kind": 6,
|
870
|
+
"importPath": "src.mbxai.openrouter.models",
|
871
|
+
"description": "src.mbxai.openrouter.models",
|
872
|
+
"peekOfCode": "class OpenRouterModel(str, Enum):\n \"\"\"Built-in OpenRouter models.\"\"\"\n GPT4_TURBO = \"openai/gpt-4-turbo-preview\"\n GPT4 = \"openai/gpt-4\"\n GPT41 = \"openai/gpt-4.1\"\n GPT35_TURBO = \"openai/gpt-3.5-turbo\"\n CLAUDE_3_OPUS = \"anthropic/claude-3-opus\"\n CLAUDE_3_SONNET = \"anthropic/claude-3-sonnet\"\n CLAUDE_3_HAIKU = \"anthropic/claude-3-haiku\"\n GEMINI_PRO = \"google/gemini-pro\"",
|
873
|
+
"detail": "src.mbxai.openrouter.models",
|
874
|
+
"documentation": {}
|
875
|
+
},
|
876
|
+
{
|
877
|
+
"label": "OpenRouterModelRegistry",
|
878
|
+
"kind": 6,
|
879
|
+
"importPath": "src.mbxai.openrouter.models",
|
880
|
+
"description": "src.mbxai.openrouter.models",
|
881
|
+
"peekOfCode": "class OpenRouterModelRegistry:\n \"\"\"Registry for OpenRouter models.\"\"\"\n _custom_models: ClassVar[dict[str, str]] = {}\n _initialized: ClassVar[bool] = False\n @classmethod\n def _initialize(cls) -> None:\n \"\"\"Initialize the registry if not already initialized.\"\"\"\n if not cls._initialized:\n cls._custom_models = {}\n cls._initialized = True",
|
882
|
+
"detail": "src.mbxai.openrouter.models",
|
883
|
+
"documentation": {}
|
884
|
+
},
|
885
|
+
{
|
886
|
+
"label": "ToolClient",
|
887
|
+
"kind": 6,
|
888
|
+
"importPath": "src.mbxai.tools.client",
|
889
|
+
"description": "src.mbxai.tools.client",
|
890
|
+
"peekOfCode": "class ToolClient:\n \"\"\"Client for handling tool calls with OpenRouter.\"\"\"\n def __init__(self, openrouter_client: OpenRouterClient) -> None:\n \"\"\"Initialize the ToolClient.\n Args:\n openrouter_client: The OpenRouter client to use\n \"\"\"\n self._client = openrouter_client\n self._tools: dict[str, Tool] = {}\n def register_tool(",
|
891
|
+
"detail": "src.mbxai.tools.client",
|
892
|
+
"documentation": {}
|
893
|
+
},
|
894
|
+
{
|
895
|
+
"label": "T",
|
896
|
+
"kind": 5,
|
897
|
+
"importPath": "src.mbxai.tools.client",
|
898
|
+
"description": "src.mbxai.tools.client",
|
899
|
+
"peekOfCode": "T = TypeVar(\"T\", bound=BaseModel)\nclass ToolClient:\n \"\"\"Client for handling tool calls with OpenRouter.\"\"\"\n def __init__(self, openrouter_client: OpenRouterClient) -> None:\n \"\"\"Initialize the ToolClient.\n Args:\n openrouter_client: The OpenRouter client to use\n \"\"\"\n self._client = openrouter_client\n self._tools: dict[str, Tool] = {}",
|
900
|
+
"detail": "src.mbxai.tools.client",
|
901
|
+
"documentation": {}
|
902
|
+
},
|
903
|
+
{
|
904
|
+
"label": "WeatherInfo",
|
905
|
+
"kind": 6,
|
906
|
+
"importPath": "src.mbxai.tools.example",
|
907
|
+
"description": "src.mbxai.tools.example",
|
908
|
+
"peekOfCode": "class WeatherInfo(BaseModel):\n \"\"\"Weather information for a location.\"\"\"\n location: str\n temperature: float\n conditions: str\n humidity: float\n# Example tool function\ndef get_weather(location: str) -> str:\n \"\"\"Get the current weather for a location.\n Args:",
|
909
|
+
"detail": "src.mbxai.tools.example",
|
910
|
+
"documentation": {}
|
911
|
+
},
|
912
|
+
{
|
913
|
+
"label": "get_weather",
|
914
|
+
"kind": 2,
|
915
|
+
"importPath": "src.mbxai.tools.example",
|
916
|
+
"description": "src.mbxai.tools.example",
|
917
|
+
"peekOfCode": "def get_weather(location: str) -> str:\n \"\"\"Get the current weather for a location.\n Args:\n location: The location to get weather for\n Returns:\n A string describing the current weather\n \"\"\"\n # In a real implementation, this would call a weather API\n return f\"The weather in {location} is sunny with a temperature of 25°C and 60% humidity.\"\ndef main() -> None:",
|
918
|
+
"detail": "src.mbxai.tools.example",
|
919
|
+
"documentation": {}
|
920
|
+
},
|
921
|
+
{
|
922
|
+
"label": "main",
|
923
|
+
"kind": 2,
|
924
|
+
"importPath": "src.mbxai.tools.example",
|
925
|
+
"description": "src.mbxai.tools.example",
|
926
|
+
"peekOfCode": "def main() -> None:\n # Initialize the OpenRouter client\n client = OpenRouterClient(token=\"your-api-key\")\n # Initialize the ToolClient\n tool_client = ToolClient(client)\n # Register the weather tool\n tool_client.register_tool(\n name=\"get_weather\",\n description=\"Get the current weather for a location\",\n function=get_weather,",
|
927
|
+
"detail": "src.mbxai.tools.example",
|
928
|
+
"documentation": {}
|
929
|
+
},
|
930
|
+
{
|
931
|
+
"label": "ToolFunction",
|
932
|
+
"kind": 6,
|
933
|
+
"importPath": "src.mbxai.tools.types",
|
934
|
+
"description": "src.mbxai.tools.types",
|
935
|
+
"peekOfCode": "class ToolFunction(TypedDict):\n \"\"\"OpenAI function definition for a tool.\"\"\"\n name: str\n description: str\n parameters: dict[str, Any]\nclass ToolCall(BaseModel):\n \"\"\"A tool call from the model.\"\"\"\n id: str\n name: str\n arguments: dict[str, Any]",
|
936
|
+
"detail": "src.mbxai.tools.types",
|
937
|
+
"documentation": {}
|
938
|
+
},
|
939
|
+
{
|
940
|
+
"label": "ToolCall",
|
941
|
+
"kind": 6,
|
942
|
+
"importPath": "src.mbxai.tools.types",
|
943
|
+
"description": "src.mbxai.tools.types",
|
944
|
+
"peekOfCode": "class ToolCall(BaseModel):\n \"\"\"A tool call from the model.\"\"\"\n id: str\n name: str\n arguments: dict[str, Any]\nclass Tool(BaseModel):\n \"\"\"A tool that can be used by the model.\"\"\"\n name: str\n description: str\n function: Callable[..., Any]",
|
945
|
+
"detail": "src.mbxai.tools.types",
|
946
|
+
"documentation": {}
|
947
|
+
},
|
948
|
+
{
|
949
|
+
"label": "Tool",
|
950
|
+
"kind": 6,
|
951
|
+
"importPath": "src.mbxai.tools.types",
|
952
|
+
"description": "src.mbxai.tools.types",
|
953
|
+
"peekOfCode": "class Tool(BaseModel):\n \"\"\"A tool that can be used by the model.\"\"\"\n name: str\n description: str\n function: Callable[..., Any]\n schema: dict[str, Any]\n def to_openai_function(self) -> ToolFunction:\n \"\"\"Convert the tool to an OpenAI function definition.\"\"\"\n return {\n \"name\": self.name,",
|
954
|
+
"detail": "src.mbxai.tools.types",
|
955
|
+
"documentation": {}
|
956
|
+
},
|
957
|
+
{
|
958
|
+
"label": "hello_world",
|
959
|
+
"kind": 2,
|
960
|
+
"importPath": "src.mbxai.core",
|
961
|
+
"description": "src.mbxai.core",
|
962
|
+
"peekOfCode": "def hello_world() -> str:\n \"\"\"\n Returns a greeting message.\n Returns:\n str: A greeting message\n \"\"\"\n return \"Hello from MBX AI!\"",
|
963
|
+
"detail": "src.mbxai.core",
|
964
|
+
"documentation": {}
|
965
|
+
},
|
966
|
+
{
|
967
|
+
"label": "test_hello_world",
|
968
|
+
"kind": 2,
|
969
|
+
"importPath": "tests.test_core",
|
970
|
+
"description": "tests.test_core",
|
971
|
+
"peekOfCode": "def test_hello_world():\n \"\"\"Test the hello_world function.\"\"\"\n assert hello_world() == \"Hello from MBX AI!\"",
|
972
|
+
"detail": "tests.test_core",
|
973
|
+
"documentation": {}
|
974
|
+
},
|
975
|
+
{
|
976
|
+
"label": "TestInput",
|
977
|
+
"kind": 6,
|
978
|
+
"importPath": "tests.test_mcp",
|
979
|
+
"description": "tests.test_mcp",
|
980
|
+
"peekOfCode": "class TestInput(BaseModel):\n \"\"\"Test input model.\"\"\"\n text: str\nclass TestOutput(BaseModel):\n \"\"\"Test output model.\"\"\"\n result: str\n count: int\n# Create a FastMCP instance for testing\nmcp = FastMCP(\"test-service\")\n# Create the test tool",
|
981
|
+
"detail": "tests.test_mcp",
|
982
|
+
"documentation": {}
|
983
|
+
},
|
984
|
+
{
|
985
|
+
"label": "TestOutput",
|
986
|
+
"kind": 6,
|
987
|
+
"importPath": "tests.test_mcp",
|
988
|
+
"description": "tests.test_mcp",
|
989
|
+
"peekOfCode": "class TestOutput(BaseModel):\n \"\"\"Test output model.\"\"\"\n result: str\n count: int\n# Create a FastMCP instance for testing\nmcp = FastMCP(\"test-service\")\n# Create the test tool\n@mcp.tool()\n@pytest.mark.skip(reason=\"This is a tool function, not a test\")\nasync def test_tool(argument: TestInput) -> TestOutput:",
|
990
|
+
"detail": "tests.test_mcp",
|
991
|
+
"documentation": {}
|
992
|
+
},
|
993
|
+
{
|
994
|
+
"label": "openrouter_client",
|
995
|
+
"kind": 2,
|
996
|
+
"importPath": "tests.test_mcp",
|
997
|
+
"description": "tests.test_mcp",
|
998
|
+
"peekOfCode": "def openrouter_client():\n \"\"\"Create a mock OpenRouter client.\"\"\"\n return Mock(spec=OpenRouterClient)\n@pytest.fixture\ndef mcp_client(openrouter_client):\n \"\"\"Create an MCP client with a mock OpenRouter client.\"\"\"\n return MCPClient(openrouter_client)\n@pytest.fixture\ndef mcp_server():\n \"\"\"Create an MCP server.\"\"\"",
|
999
|
+
"detail": "tests.test_mcp",
|
1000
|
+
"documentation": {}
|
1001
|
+
},
|
1002
|
+
{
|
1003
|
+
"label": "mcp_client",
|
1004
|
+
"kind": 2,
|
1005
|
+
"importPath": "tests.test_mcp",
|
1006
|
+
"description": "tests.test_mcp",
|
1007
|
+
"peekOfCode": "def mcp_client(openrouter_client):\n \"\"\"Create an MCP client with a mock OpenRouter client.\"\"\"\n return MCPClient(openrouter_client)\n@pytest.fixture\ndef mcp_server():\n \"\"\"Create an MCP server.\"\"\"\n server = MCPServer(\"test-service\")\n server.app.dependency_overrides = {} # Clear any overrides\n return server\n@pytest.fixture",
|
1008
|
+
"detail": "tests.test_mcp",
|
1009
|
+
"documentation": {}
|
1010
|
+
},
|
1011
|
+
{
|
1012
|
+
"label": "mcp_server",
|
1013
|
+
"kind": 2,
|
1014
|
+
"importPath": "tests.test_mcp",
|
1015
|
+
"description": "tests.test_mcp",
|
1016
|
+
"peekOfCode": "def mcp_server():\n \"\"\"Create an MCP server.\"\"\"\n server = MCPServer(\"test-service\")\n server.app.dependency_overrides = {} # Clear any overrides\n return server\n@pytest.fixture\ndef test_client(mcp_server):\n \"\"\"Create a test client for the FastAPI app.\"\"\"\n return TestClient(mcp_server.app)\n@pytest.mark.asyncio",
|
1017
|
+
"detail": "tests.test_mcp",
|
1018
|
+
"documentation": {}
|
1019
|
+
},
|
1020
|
+
{
|
1021
|
+
"label": "test_client",
|
1022
|
+
"kind": 2,
|
1023
|
+
"importPath": "tests.test_mcp",
|
1024
|
+
"description": "tests.test_mcp",
|
1025
|
+
"peekOfCode": "def test_client(mcp_server):\n \"\"\"Create a test client for the FastAPI app.\"\"\"\n return TestClient(mcp_server.app)\n@pytest.mark.asyncio\nasync def test_register_mcp_server(mcp_client):\n \"\"\"Test registering an MCP server.\"\"\"\n # Mock the HTTP client\n mock_response = Mock()\n mock_response.json.return_value = [\n {",
|
1026
|
+
"detail": "tests.test_mcp",
|
1027
|
+
"documentation": {}
|
1028
|
+
},
|
1029
|
+
{
|
1030
|
+
"label": "mcp",
|
1031
|
+
"kind": 5,
|
1032
|
+
"importPath": "tests.test_mcp",
|
1033
|
+
"description": "tests.test_mcp",
|
1034
|
+
"peekOfCode": "mcp = FastMCP(\"test-service\")\n# Create the test tool\n@mcp.tool()\n@pytest.mark.skip(reason=\"This is a tool function, not a test\")\nasync def test_tool(argument: TestInput) -> TestOutput:\n \"\"\"A test tool that returns a simple response.\"\"\"\n return TestOutput(\n result=f\"Processed: {argument.text}\",\n count=len(argument.text)\n )",
|
1035
|
+
"detail": "tests.test_mcp",
|
1036
|
+
"documentation": {}
|
1037
|
+
},
|
1038
|
+
{
|
1039
|
+
"label": "Step",
|
1040
|
+
"kind": 6,
|
1041
|
+
"importPath": "tests.test_openrouter",
|
1042
|
+
"description": "tests.test_openrouter",
|
1043
|
+
"peekOfCode": "class Step(BaseModel):\n \"\"\"A step in a coding task.\"\"\"\n file_path: str\n repo_name: str\n type: str\n diff: str\n description: str\n commit_message: str\nclass CodingOutput(BaseModel):\n \"\"\"Structured output for coding tasks.\"\"\"",
|
1044
|
+
"detail": "tests.test_openrouter",
|
1045
|
+
"documentation": {}
|
1046
|
+
},
|
1047
|
+
{
|
1048
|
+
"label": "CodingOutput",
|
1049
|
+
"kind": 6,
|
1050
|
+
"importPath": "tests.test_openrouter",
|
1051
|
+
"description": "tests.test_openrouter",
|
1052
|
+
"peekOfCode": "class CodingOutput(BaseModel):\n \"\"\"Structured output for coding tasks.\"\"\"\n steps: list[Step]\nclass SimpleOutput(BaseModel):\n \"\"\"Simple structured output for testing.\"\"\"\n message: str\n count: int\n@pytest.fixture\ndef client():\n \"\"\"Create a test client with API key from environment.\"\"\"",
|
1053
|
+
"detail": "tests.test_openrouter",
|
1054
|
+
"documentation": {}
|
1055
|
+
},
|
1056
|
+
{
|
1057
|
+
"label": "SimpleOutput",
|
1058
|
+
"kind": 6,
|
1059
|
+
"importPath": "tests.test_openrouter",
|
1060
|
+
"description": "tests.test_openrouter",
|
1061
|
+
"peekOfCode": "class SimpleOutput(BaseModel):\n \"\"\"Simple structured output for testing.\"\"\"\n message: str\n count: int\n@pytest.fixture\ndef client():\n \"\"\"Create a test client with API key from environment.\"\"\"\n if not API_KEY or API_KEY == \"test-token\":\n pytest.skip(\"OPENROUTER_API_KEY not set in environment\")\n return OpenRouterClient(token=API_KEY)",
|
1062
|
+
"detail": "tests.test_openrouter",
|
1063
|
+
"documentation": {}
|
1064
|
+
},
|
1065
|
+
{
|
1066
|
+
"label": "client",
|
1067
|
+
"kind": 2,
|
1068
|
+
"importPath": "tests.test_openrouter",
|
1069
|
+
"description": "tests.test_openrouter",
|
1070
|
+
"peekOfCode": "def client():\n \"\"\"Create a test client with API key from environment.\"\"\"\n if not API_KEY or API_KEY == \"test-token\":\n pytest.skip(\"OPENROUTER_API_KEY not set in environment\")\n return OpenRouterClient(token=API_KEY)\ndef test_openrouter_config_default_url():\n \"\"\"Test that OpenRouterConfig accepts default URL.\"\"\"\n config = OpenRouterConfig(token=API_KEY)\n assert str(config.base_url) == \"https://openrouter.ai/api/v1\"\ndef test_openrouter_config_custom_url():",
|
1071
|
+
"detail": "tests.test_openrouter",
|
1072
|
+
"documentation": {}
|
1073
|
+
},
|
1074
|
+
{
|
1075
|
+
"label": "test_openrouter_config_default_url",
|
1076
|
+
"kind": 2,
|
1077
|
+
"importPath": "tests.test_openrouter",
|
1078
|
+
"description": "tests.test_openrouter",
|
1079
|
+
"peekOfCode": "def test_openrouter_config_default_url():\n \"\"\"Test that OpenRouterConfig accepts default URL.\"\"\"\n config = OpenRouterConfig(token=API_KEY)\n assert str(config.base_url) == \"https://openrouter.ai/api/v1\"\ndef test_openrouter_config_custom_url():\n \"\"\"Test that OpenRouterConfig accepts custom URL.\"\"\"\n config = OpenRouterConfig(\n token=API_KEY,\n base_url=\"https://custom.api.example.com\",\n )",
|
1080
|
+
"detail": "tests.test_openrouter",
|
1081
|
+
"documentation": {}
|
1082
|
+
},
|
1083
|
+
{
|
1084
|
+
"label": "test_openrouter_config_custom_url",
|
1085
|
+
"kind": 2,
|
1086
|
+
"importPath": "tests.test_openrouter",
|
1087
|
+
"description": "tests.test_openrouter",
|
1088
|
+
"peekOfCode": "def test_openrouter_config_custom_url():\n \"\"\"Test that OpenRouterConfig accepts custom URL.\"\"\"\n config = OpenRouterConfig(\n token=API_KEY,\n base_url=\"https://custom.api.example.com\",\n )\n assert str(config.base_url) == \"https://custom.api.example.com/\"\ndef test_openrouter_config_invalid_token():\n \"\"\"Test that OpenRouterConfig validates token format.\"\"\"\n with pytest.raises(ValueError, match=\"Token cannot be empty\"):",
|
1089
|
+
"detail": "tests.test_openrouter",
|
1090
|
+
"documentation": {}
|
1091
|
+
},
|
1092
|
+
{
|
1093
|
+
"label": "test_openrouter_config_invalid_token",
|
1094
|
+
"kind": 2,
|
1095
|
+
"importPath": "tests.test_openrouter",
|
1096
|
+
"description": "tests.test_openrouter",
|
1097
|
+
"peekOfCode": "def test_openrouter_config_invalid_token():\n \"\"\"Test that OpenRouterConfig validates token format.\"\"\"\n with pytest.raises(ValueError, match=\"Token cannot be empty\"):\n OpenRouterConfig(token=\" \") # Empty or whitespace-only token\ndef test_openrouter_config_default_model():\n \"\"\"Test that OpenRouterConfig uses GPT-4 Turbo as default model.\"\"\"\n config = OpenRouterConfig(token=API_KEY)\n assert config.model == OpenRouterModel.GPT4_TURBO\n assert config.model.value == \"openai/gpt-4-turbo-preview\"\ndef test_openrouter_config_custom_model():",
|
1098
|
+
"detail": "tests.test_openrouter",
|
1099
|
+
"documentation": {}
|
1100
|
+
},
|
1101
|
+
{
|
1102
|
+
"label": "test_openrouter_config_default_model",
|
1103
|
+
"kind": 2,
|
1104
|
+
"importPath": "tests.test_openrouter",
|
1105
|
+
"description": "tests.test_openrouter",
|
1106
|
+
"peekOfCode": "def test_openrouter_config_default_model():\n \"\"\"Test that OpenRouterConfig uses GPT-4 Turbo as default model.\"\"\"\n config = OpenRouterConfig(token=API_KEY)\n assert config.model == OpenRouterModel.GPT4_TURBO\n assert config.model.value == \"openai/gpt-4-turbo-preview\"\ndef test_openrouter_config_custom_model():\n \"\"\"Test that OpenRouterConfig accepts custom model.\"\"\"\n config = OpenRouterConfig(\n token=API_KEY,\n model=OpenRouterModel.CLAUDE_3_OPUS,",
|
1107
|
+
"detail": "tests.test_openrouter",
|
1108
|
+
"documentation": {}
|
1109
|
+
},
|
1110
|
+
{
|
1111
|
+
"label": "test_openrouter_config_custom_model",
|
1112
|
+
"kind": 2,
|
1113
|
+
"importPath": "tests.test_openrouter",
|
1114
|
+
"description": "tests.test_openrouter",
|
1115
|
+
"peekOfCode": "def test_openrouter_config_custom_model():\n \"\"\"Test that OpenRouterConfig accepts custom model.\"\"\"\n config = OpenRouterConfig(\n token=API_KEY,\n model=OpenRouterModel.CLAUDE_3_OPUS,\n )\n assert str(config.model) == OpenRouterModel.CLAUDE_3_OPUS.value\ndef test_openrouter_client_initialization():\n \"\"\"Test OpenRouterClient initialization.\"\"\"\n client = OpenRouterClient(token=API_KEY)",
|
1116
|
+
"detail": "tests.test_openrouter",
|
1117
|
+
"documentation": {}
|
1118
|
+
},
|
1119
|
+
{
|
1120
|
+
"label": "test_openrouter_client_initialization",
|
1121
|
+
"kind": 2,
|
1122
|
+
"importPath": "tests.test_openrouter",
|
1123
|
+
"description": "tests.test_openrouter",
|
1124
|
+
"peekOfCode": "def test_openrouter_client_initialization():\n \"\"\"Test OpenRouterClient initialization.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n assert isinstance(client.config, OpenRouterConfig)\n assert client.config.token == API_KEY\n assert str(client.config.base_url) == \"https://openrouter.ai/api/v1/\"\n assert client.config.model == OpenRouterModel.GPT4_TURBO\ndef test_openrouter_client_custom_url():\n \"\"\"Test OpenRouterClient with custom URL.\"\"\"\n client = OpenRouterClient(",
|
1125
|
+
"detail": "tests.test_openrouter",
|
1126
|
+
"documentation": {}
|
1127
|
+
},
|
1128
|
+
{
|
1129
|
+
"label": "test_openrouter_client_custom_url",
|
1130
|
+
"kind": 2,
|
1131
|
+
"importPath": "tests.test_openrouter",
|
1132
|
+
"description": "tests.test_openrouter",
|
1133
|
+
"peekOfCode": "def test_openrouter_client_custom_url():\n \"\"\"Test OpenRouterClient with custom URL.\"\"\"\n client = OpenRouterClient(\n token=API_KEY,\n base_url=\"https://custom.api.example.com\",\n )\n assert str(client.config.base_url) == \"https://custom.api.example.com/\"\ndef test_openrouter_client_custom_model():\n \"\"\"Test OpenRouterClient with custom model.\"\"\"\n client = OpenRouterClient(",
|
1134
|
+
"detail": "tests.test_openrouter",
|
1135
|
+
"documentation": {}
|
1136
|
+
},
|
1137
|
+
{
|
1138
|
+
"label": "test_openrouter_client_custom_model",
|
1139
|
+
"kind": 2,
|
1140
|
+
"importPath": "tests.test_openrouter",
|
1141
|
+
"description": "tests.test_openrouter",
|
1142
|
+
"peekOfCode": "def test_openrouter_client_custom_model():\n \"\"\"Test OpenRouterClient with custom model.\"\"\"\n client = OpenRouterClient(\n token=API_KEY,\n model=OpenRouterModel.CLAUDE_3_OPUS,\n )\n assert client.config.model == OpenRouterModel.CLAUDE_3_OPUS\ndef test_openrouter_client_custom_model_and_url():\n \"\"\"Test OpenRouterClient with custom model and URL.\"\"\"\n client = OpenRouterClient(",
|
1143
|
+
"detail": "tests.test_openrouter",
|
1144
|
+
"documentation": {}
|
1145
|
+
},
|
1146
|
+
{
|
1147
|
+
"label": "test_openrouter_client_custom_model_and_url",
|
1148
|
+
"kind": 2,
|
1149
|
+
"importPath": "tests.test_openrouter",
|
1150
|
+
"description": "tests.test_openrouter",
|
1151
|
+
"peekOfCode": "def test_openrouter_client_custom_model_and_url():\n \"\"\"Test OpenRouterClient with custom model and URL.\"\"\"\n client = OpenRouterClient(\n token=API_KEY,\n model=OpenRouterModel.GEMINI_PRO,\n base_url=\"https://custom.api.example.com\",\n )\n assert client.config.model == OpenRouterModel.GEMINI_PRO\n assert str(client.config.base_url) == \"https://custom.api.example.com/\"\ndef test_openrouter_client_set_model():",
|
1152
|
+
"detail": "tests.test_openrouter",
|
1153
|
+
"documentation": {}
|
1154
|
+
},
|
1155
|
+
{
|
1156
|
+
"label": "test_openrouter_client_set_model",
|
1157
|
+
"kind": 2,
|
1158
|
+
"importPath": "tests.test_openrouter",
|
1159
|
+
"description": "tests.test_openrouter",
|
1160
|
+
"peekOfCode": "def test_openrouter_client_set_model():\n \"\"\"Test setting a new model after client initialization.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n assert client.config.model == OpenRouterModel.GPT4_TURBO\n client.set_model(OpenRouterModel.CLAUDE_3_OPUS)\n assert client.config.model == OpenRouterModel.CLAUDE_3_OPUS\n client.set_model(OpenRouterModel.GEMINI_PRO)\n assert client.config.model == OpenRouterModel.GEMINI_PRO\ndef test_register_custom_model():\n \"\"\"Test registering a custom model.\"\"\"",
|
1161
|
+
"detail": "tests.test_openrouter",
|
1162
|
+
"documentation": {}
|
1163
|
+
},
|
1164
|
+
{
|
1165
|
+
"label": "test_register_custom_model",
|
1166
|
+
"kind": 2,
|
1167
|
+
"importPath": "tests.test_openrouter",
|
1168
|
+
"description": "tests.test_openrouter",
|
1169
|
+
"peekOfCode": "def test_register_custom_model():\n \"\"\"Test registering a custom model.\"\"\"\n # Register a new model\n OpenRouterClient.register_model(\"CUSTOM_MODEL\", \"custom/model-1\")\n # Verify the model is in the list\n models = OpenRouterClient.list_models()\n assert \"CUSTOM_MODEL\" in models\n assert models[\"CUSTOM_MODEL\"] == \"custom/model-1\"\ndef test_register_duplicate_model():\n \"\"\"Test that registering a duplicate model raises an error.\"\"\"",
|
1170
|
+
"detail": "tests.test_openrouter",
|
1171
|
+
"documentation": {}
|
1172
|
+
},
|
1173
|
+
{
|
1174
|
+
"label": "test_register_duplicate_model",
|
1175
|
+
"kind": 2,
|
1176
|
+
"importPath": "tests.test_openrouter",
|
1177
|
+
"description": "tests.test_openrouter",
|
1178
|
+
"peekOfCode": "def test_register_duplicate_model():\n \"\"\"Test that registering a duplicate model raises an error.\"\"\"\n # Register a model\n OpenRouterClient.register_model(\"DUPLICATE_MODEL\", \"custom/model-2\")\n # Try to register it again\n with pytest.raises(ValueError, match=\"Model DUPLICATE_MODEL is already registered\"):\n OpenRouterClient.register_model(\"DUPLICATE_MODEL\", \"custom/model-3\")\ndef test_list_models_includes_builtin_and_custom():\n \"\"\"Test that list_models includes both built-in and custom models.\"\"\"\n # Register a custom model",
|
1179
|
+
"detail": "tests.test_openrouter",
|
1180
|
+
"documentation": {}
|
1181
|
+
},
|
1182
|
+
{
|
1183
|
+
"label": "test_list_models_includes_builtin_and_custom",
|
1184
|
+
"kind": 2,
|
1185
|
+
"importPath": "tests.test_openrouter",
|
1186
|
+
"description": "tests.test_openrouter",
|
1187
|
+
"peekOfCode": "def test_list_models_includes_builtin_and_custom():\n \"\"\"Test that list_models includes both built-in and custom models.\"\"\"\n # Register a custom model\n OpenRouterClient.register_model(\"TEST_MODEL\", \"test/model-1\")\n # Get all models\n models = OpenRouterClient.list_models()\n # Check that both built-in and custom models are present\n assert \"GPT4_TURBO\" in models # Built-in\n assert \"TEST_MODEL\" in models # Custom\n assert models[\"GPT4_TURBO\"] == \"openai/gpt-4-turbo-preview\"",
|
1188
|
+
"detail": "tests.test_openrouter",
|
1189
|
+
"documentation": {}
|
1190
|
+
},
|
1191
|
+
{
|
1192
|
+
"label": "test_chat_completion",
|
1193
|
+
"kind": 2,
|
1194
|
+
"importPath": "tests.test_openrouter",
|
1195
|
+
"description": "tests.test_openrouter",
|
1196
|
+
"peekOfCode": "def test_chat_completion():\n \"\"\"Test chat completion functionality.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n messages = [\n {\"role\": \"user\", \"content\": \"Hello, how are you?\"}\n ]\n response = client.chat_completion(messages)\n assert response is not None\n assert hasattr(response, \"choices\")\n assert len(response.choices) > 0",
|
1197
|
+
"detail": "tests.test_openrouter",
|
1198
|
+
"documentation": {}
|
1199
|
+
},
|
1200
|
+
{
|
1201
|
+
"label": "test_streaming_chat_completion",
|
1202
|
+
"kind": 2,
|
1203
|
+
"importPath": "tests.test_openrouter",
|
1204
|
+
"description": "tests.test_openrouter",
|
1205
|
+
"peekOfCode": "def test_streaming_chat_completion():\n \"\"\"Test streaming chat completion functionality.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n messages = [\n {\"role\": \"user\", \"content\": \"Hello, how are you?\"}\n ]\n response = client.chat_completion(messages, stream=True)\n assert response is not None\n assert hasattr(response, \"__iter__\") # Should be an iterator\n chunks = list(response) # Collect all chunks",
|
1206
|
+
"detail": "tests.test_openrouter",
|
1207
|
+
"documentation": {}
|
1208
|
+
},
|
1209
|
+
{
|
1210
|
+
"label": "test_custom_model_chat_completion",
|
1211
|
+
"kind": 2,
|
1212
|
+
"importPath": "tests.test_openrouter",
|
1213
|
+
"description": "tests.test_openrouter",
|
1214
|
+
"peekOfCode": "def test_custom_model_chat_completion():\n \"\"\"Test chat completion with a custom model.\"\"\"\n # Register a custom model with a valid provider/model format\n model_name = \"TEST_MODEL_\" + str(hash(\"test\")) # Generate unique name\n OpenRouterClient.register_model(model_name, \"openai/gpt-3.5-turbo\")\n client = OpenRouterClient(token=API_KEY, model=model_name)\n messages = [\n {\"role\": \"user\", \"content\": \"Hello, how are you?\"}\n ]\n response = client.chat_completion(messages)",
|
1215
|
+
"detail": "tests.test_openrouter",
|
1216
|
+
"documentation": {}
|
1217
|
+
},
|
1218
|
+
{
|
1219
|
+
"label": "test_custom_default_headers",
|
1220
|
+
"kind": 2,
|
1221
|
+
"importPath": "tests.test_openrouter",
|
1222
|
+
"description": "tests.test_openrouter",
|
1223
|
+
"peekOfCode": "def test_custom_default_headers():\n \"\"\"Test custom default headers.\"\"\"\n custom_headers = {\n \"HTTP-Referer\": \"https://custom.example.com\",\n \"X-Title\": \"Custom App\",\n \"X-Custom\": \"test-value\"\n }\n client = OpenRouterClient(\n token=API_KEY,\n default_headers=custom_headers",
|
1224
|
+
"detail": "tests.test_openrouter",
|
1225
|
+
"documentation": {}
|
1226
|
+
},
|
1227
|
+
{
|
1228
|
+
"label": "test_chat_completion_parse_simple",
|
1229
|
+
"kind": 2,
|
1230
|
+
"importPath": "tests.test_openrouter",
|
1231
|
+
"description": "tests.test_openrouter",
|
1232
|
+
"peekOfCode": "def test_chat_completion_parse_simple(client):\n \"\"\"Test chat completion with simple structured output.\"\"\"\n messages = [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\",\n },\n {\n \"content\": \"Return a simple message with count 42.\",\n \"role\": \"user\",",
|
1233
|
+
"detail": "tests.test_openrouter",
|
1234
|
+
"documentation": {}
|
1235
|
+
},
|
1236
|
+
{
|
1237
|
+
"label": "test_chat_completion_parse_coding",
|
1238
|
+
"kind": 2,
|
1239
|
+
"importPath": "tests.test_openrouter",
|
1240
|
+
"description": "tests.test_openrouter",
|
1241
|
+
"peekOfCode": "def test_chat_completion_parse_coding(client):\n \"\"\"Test chat completion with coding task structured output.\"\"\"\n messages = [\n {\n \"content\": \"You are an exceptional principal engineer that is amazing at finding and fixing issues in codebases.\",\n \"role\": \"system\",\n },\n {\n \"content\": \"We need to enhance error handling in the `from_str` method.\",\n \"role\": \"assistant\",",
|
1242
|
+
"detail": "tests.test_openrouter",
|
1243
|
+
"documentation": {}
|
1244
|
+
},
|
1245
|
+
{
|
1246
|
+
"label": "test_chat_completion_parse_with_tool_calls",
|
1247
|
+
"kind": 2,
|
1248
|
+
"importPath": "tests.test_openrouter",
|
1249
|
+
"description": "tests.test_openrouter",
|
1250
|
+
"peekOfCode": "def test_chat_completion_parse_with_tool_calls(client):\n \"\"\"Test chat completion with structured output and tool calls.\"\"\"\n messages = [\n {\n \"content\": \"You are an exceptional principal engineer that is amazing at finding and fixing issues in codebases.\",\n \"role\": \"system\",\n },\n {\n \"content\": None, # Important: content must be None for tool calls\n \"role\": \"assistant\",",
|
1251
|
+
"detail": "tests.test_openrouter",
|
1252
|
+
"documentation": {}
|
1253
|
+
},
|
1254
|
+
{
|
1255
|
+
"label": "test_chat_completion_parse_invalid_model",
|
1256
|
+
"kind": 2,
|
1257
|
+
"importPath": "tests.test_openrouter",
|
1258
|
+
"description": "tests.test_openrouter",
|
1259
|
+
"peekOfCode": "def test_chat_completion_parse_invalid_model(client):\n \"\"\"Test chat completion with invalid response format.\"\"\"\n messages = [\n {\"role\": \"user\", \"content\": \"Hello\"}\n ]\n with pytest.raises(ValueError):\n client.chat_completion_parse(\n messages=messages,\n response_format=str, # Invalid response format\n )",
|
1260
|
+
"detail": "tests.test_openrouter",
|
1261
|
+
"documentation": {}
|
1262
|
+
},
|
1263
|
+
{
|
1264
|
+
"label": "test_chat_completion_parse_streaming",
|
1265
|
+
"kind": 2,
|
1266
|
+
"importPath": "tests.test_openrouter",
|
1267
|
+
"description": "tests.test_openrouter",
|
1268
|
+
"peekOfCode": "def test_chat_completion_parse_streaming(client):\n \"\"\"Test streaming chat completion with structured output.\"\"\"\n messages = [\n {\"role\": \"user\", \"content\": \"Count to 3.\"}\n ]\n response = client.chat_completion_parse(\n messages=messages,\n response_format=SimpleOutput,\n stream=True,\n )",
|
1269
|
+
"detail": "tests.test_openrouter",
|
1270
|
+
"documentation": {}
|
1271
|
+
},
|
1272
|
+
{
|
1273
|
+
"label": "test_chat_completion_parse_with_custom_model",
|
1274
|
+
"kind": 2,
|
1275
|
+
"importPath": "tests.test_openrouter",
|
1276
|
+
"description": "tests.test_openrouter",
|
1277
|
+
"peekOfCode": "def test_chat_completion_parse_with_custom_model(client):\n \"\"\"Test chat completion with a custom model.\"\"\"\n messages = [\n {\n \"role\": \"system\",\n \"content\": \"\"\"You are a helpful assistant that responds in valid JSON format.\n When asked to respond, provide a JSON object with two fields:\n - message: a string containing your response\n - count: an integer representing the number of words in your message\"\"\"\n },",
|
1278
|
+
"detail": "tests.test_openrouter",
|
1279
|
+
"documentation": {}
|
1280
|
+
},
|
1281
|
+
{
|
1282
|
+
"label": "test_embeddings",
|
1283
|
+
"kind": 2,
|
1284
|
+
"importPath": "tests.test_openrouter",
|
1285
|
+
"description": "tests.test_openrouter",
|
1286
|
+
"peekOfCode": "def test_embeddings():\n \"\"\"Test embeddings functionality.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n text = \"This is a test sentence.\"\n response = client.embeddings(text)\n assert response is not None\n assert hasattr(response, \"data\")\n assert len(response.data) > 0\n assert hasattr(response.data[0], \"embedding\")\n assert len(response.data[0].embedding) > 0",
|
1287
|
+
"detail": "tests.test_openrouter",
|
1288
|
+
"documentation": {}
|
1289
|
+
},
|
1290
|
+
{
|
1291
|
+
"label": "test_embeddings_parse",
|
1292
|
+
"kind": 2,
|
1293
|
+
"importPath": "tests.test_openrouter",
|
1294
|
+
"description": "tests.test_openrouter",
|
1295
|
+
"peekOfCode": "def test_embeddings_parse():\n \"\"\"Test embeddings with parse functionality.\"\"\"\n client = OpenRouterClient(token=API_KEY)\n text = \"This is a test sentence.\"\n # Test with parse=True (default)\n parsed_response = client.embeddings(text, parse=True)\n assert parsed_response is not None\n assert isinstance(parsed_response, list)\n assert len(parsed_response) > 0\n assert isinstance(parsed_response[0], list)",
|
1296
|
+
"detail": "tests.test_openrouter",
|
1297
|
+
"documentation": {}
|
1298
|
+
},
|
1299
|
+
{
|
1300
|
+
"label": "API_KEY",
|
1301
|
+
"kind": 5,
|
1302
|
+
"importPath": "tests.test_openrouter",
|
1303
|
+
"description": "tests.test_openrouter",
|
1304
|
+
"peekOfCode": "API_KEY = os.getenv(\"OPENROUTER_API_KEY\", \"test-token\")\n# Test models\nclass Step(BaseModel):\n \"\"\"A step in a coding task.\"\"\"\n file_path: str\n repo_name: str\n type: str\n diff: str\n description: str\n commit_message: str",
|
1305
|
+
"detail": "tests.test_openrouter",
|
1306
|
+
"documentation": {}
|
1307
|
+
},
|
1308
|
+
{
|
1309
|
+
"label": "TestOutput",
|
1310
|
+
"kind": 6,
|
1311
|
+
"importPath": "tests.test_tools",
|
1312
|
+
"description": "tests.test_tools",
|
1313
|
+
"peekOfCode": "class TestOutput(BaseModel):\n \"\"\"Test output model.\"\"\"\n message: str\n count: int\ndef test_tool_registration():\n \"\"\"Test tool registration.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Define a test tool",
|
1314
|
+
"detail": "tests.test_tools",
|
1315
|
+
"documentation": {}
|
1316
|
+
},
|
1317
|
+
{
|
1318
|
+
"label": "test_tool_registration",
|
1319
|
+
"kind": 2,
|
1320
|
+
"importPath": "tests.test_tools",
|
1321
|
+
"description": "tests.test_tools",
|
1322
|
+
"peekOfCode": "def test_tool_registration():\n \"\"\"Test tool registration.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Define a test tool\n def test_function(arg1: str) -> str:\n return f\"Test: {arg1}\"\n # Register the tool\n tool_client.register_tool(",
|
1323
|
+
"detail": "tests.test_tools",
|
1324
|
+
"documentation": {}
|
1325
|
+
},
|
1326
|
+
{
|
1327
|
+
"label": "test_chat_without_tools",
|
1328
|
+
"kind": 2,
|
1329
|
+
"importPath": "tests.test_tools",
|
1330
|
+
"description": "tests.test_tools",
|
1331
|
+
"peekOfCode": "def test_chat_without_tools():\n \"\"\"Test chat without any tools.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Mock response\n mock_response = Mock()\n mock_response.choices = [Mock()]\n mock_response.choices[0].message = Mock()\n mock_response.choices[0].message.content = \"Hello!\"",
|
1332
|
+
"detail": "tests.test_tools",
|
1333
|
+
"documentation": {}
|
1334
|
+
},
|
1335
|
+
{
|
1336
|
+
"label": "test_chat_with_tools",
|
1337
|
+
"kind": 2,
|
1338
|
+
"importPath": "tests.test_tools",
|
1339
|
+
"description": "tests.test_tools",
|
1340
|
+
"peekOfCode": "def test_chat_with_tools():\n \"\"\"Test chat with tool calls.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Register a test tool\n def test_function(arg1: str) -> str:\n return f\"Result: {arg1}\"\n tool_client.register_tool(\n name=\"test_tool\",",
|
1341
|
+
"detail": "tests.test_tools",
|
1342
|
+
"documentation": {}
|
1343
|
+
},
|
1344
|
+
{
|
1345
|
+
"label": "test_parse_without_tools",
|
1346
|
+
"kind": 2,
|
1347
|
+
"importPath": "tests.test_tools",
|
1348
|
+
"description": "tests.test_tools",
|
1349
|
+
"peekOfCode": "def test_parse_without_tools():\n \"\"\"Test parse without any tools.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Mock response\n mock_response = Mock()\n mock_response.choices = [Mock()]\n mock_response.choices[0].message = Mock()\n mock_response.choices[0].message.content = '{\"message\": \"Hello\", \"count\": 42}'",
|
1350
|
+
"detail": "tests.test_tools",
|
1351
|
+
"documentation": {}
|
1352
|
+
},
|
1353
|
+
{
|
1354
|
+
"label": "test_parse_with_tools",
|
1355
|
+
"kind": 2,
|
1356
|
+
"importPath": "tests.test_tools",
|
1357
|
+
"description": "tests.test_tools",
|
1358
|
+
"peekOfCode": "def test_parse_with_tools():\n \"\"\"Test parse with tool calls.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Register a test tool\n def test_function(arg1: str) -> str:\n return f\"Result: {arg1}\"\n tool_client.register_tool(\n name=\"test_tool\",",
|
1359
|
+
"detail": "tests.test_tools",
|
1360
|
+
"documentation": {}
|
1361
|
+
},
|
1362
|
+
{
|
1363
|
+
"label": "test_streaming_chat",
|
1364
|
+
"kind": 2,
|
1365
|
+
"importPath": "tests.test_tools",
|
1366
|
+
"description": "tests.test_tools",
|
1367
|
+
"peekOfCode": "def test_streaming_chat():\n \"\"\"Test streaming chat.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Mock response\n mock_response = Mock()\n mock_response.choices = [Mock()]\n mock_response.choices[0].delta = Mock()\n mock_response.choices[0].delta.content = \"Hello\"",
|
1368
|
+
"detail": "tests.test_tools",
|
1369
|
+
"documentation": {}
|
1370
|
+
},
|
1371
|
+
{
|
1372
|
+
"label": "test_streaming_parse",
|
1373
|
+
"kind": 2,
|
1374
|
+
"importPath": "tests.test_tools",
|
1375
|
+
"description": "tests.test_tools",
|
1376
|
+
"peekOfCode": "def test_streaming_parse():\n \"\"\"Test streaming parse.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Mock response\n mock_response = Mock()\n mock_response.choices = [Mock()]\n mock_response.choices[0].delta = Mock()\n mock_response.choices[0].delta.content = '{\"message\": \"Hello\", \"count\": 42}'",
|
1377
|
+
"detail": "tests.test_tools",
|
1378
|
+
"documentation": {}
|
1379
|
+
},
|
1380
|
+
{
|
1381
|
+
"label": "test_unknown_tool",
|
1382
|
+
"kind": 2,
|
1383
|
+
"importPath": "tests.test_tools",
|
1384
|
+
"description": "tests.test_tools",
|
1385
|
+
"peekOfCode": "def test_unknown_tool():\n \"\"\"Test handling of unknown tool calls.\"\"\"\n # Setup\n openrouter_client = Mock(spec=OpenRouterClient)\n tool_client = ToolClient(openrouter_client)\n # Mock response with unknown tool\n mock_tool_call = Mock()\n mock_tool_call.function = Mock()\n mock_tool_call.function.name = \"unknown_tool\"\n mock_tool_call.function.arguments = {\"arg1\": \"test\"}",
|
1386
|
+
"detail": "tests.test_tools",
|
1387
|
+
"documentation": {}
|
1388
|
+
}
|
1389
|
+
]
|