meshagent-openai 0.0.30__tar.gz → 0.0.32__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.
Potentially problematic release.
This version of meshagent-openai might be problematic. Click here for more details.
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/CHANGELOG.md +8 -2
- {meshagent_openai-0.0.30/meshagent_openai.egg-info → meshagent_openai-0.0.32}/PKG-INFO +5 -5
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/proxy/proxy.py +2 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/tools/__init__.py +2 -1
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/tools/completions_adapter.py +9 -28
- meshagent_openai-0.0.32/meshagent/openai/tools/responses_adapter.py +1177 -0
- meshagent_openai-0.0.32/meshagent/openai/tools/schema.py +202 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/tools/stt.py +0 -2
- meshagent_openai-0.0.32/meshagent/openai/tools/stt_test.py +85 -0
- meshagent_openai-0.0.32/meshagent/openai/version.py +1 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32/meshagent_openai.egg-info}/PKG-INFO +5 -5
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent_openai.egg-info/SOURCES.txt +2 -0
- meshagent_openai-0.0.32/meshagent_openai.egg-info/requires.txt +7 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/pyproject.toml +4 -4
- meshagent_openai-0.0.30/meshagent/openai/tools/responses_adapter.py +0 -564
- meshagent_openai-0.0.30/meshagent/openai/version.py +0 -1
- meshagent_openai-0.0.30/meshagent_openai.egg-info/requires.txt +0 -7
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/LICENSE +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/MANIFEST.in +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/README.md +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/__init__.py +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/proxy/__init__.py +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent_openai.egg-info/dependency_links.txt +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent_openai.egg-info/top_level.txt +0 -0
- {meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-openai
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.32
|
|
4
4
|
Summary: OpenAI Building Blocks for Meshagent
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://docs.meshagent.com
|
|
@@ -12,10 +12,10 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: pyjwt~=2.10.1
|
|
13
13
|
Requires-Dist: pytest~=8.3.5
|
|
14
14
|
Requires-Dist: pytest-asyncio~=0.26.0
|
|
15
|
-
Requires-Dist: openai~=1.
|
|
16
|
-
Requires-Dist: meshagent-api~=0.0.
|
|
17
|
-
Requires-Dist: meshagent-agents~=0.0.
|
|
18
|
-
Requires-Dist: meshagent-tools~=0.0.
|
|
15
|
+
Requires-Dist: openai~=1.86.0
|
|
16
|
+
Requires-Dist: meshagent-api~=0.0.32
|
|
17
|
+
Requires-Dist: meshagent-agents~=0.0.32
|
|
18
|
+
Requires-Dist: meshagent-tools~=0.0.32
|
|
19
19
|
Dynamic: license-file
|
|
20
20
|
|
|
21
21
|
### Meshagent OpenAI
|
|
@@ -9,9 +9,11 @@ def get_client(*, room: RoomClient) -> AsyncOpenAI:
|
|
|
9
9
|
url : str = room.room_url
|
|
10
10
|
|
|
11
11
|
room_proxy_url = f"{url}/v1"
|
|
12
|
+
|
|
12
13
|
if room_proxy_url.startswith("ws:") or room_proxy_url.startswith("wss:"):
|
|
13
14
|
room_proxy_url = room_proxy_url.replace("ws","http",1)
|
|
14
15
|
|
|
16
|
+
print(room_proxy_url)
|
|
15
17
|
openai=AsyncOpenAI(
|
|
16
18
|
api_key=token,
|
|
17
19
|
base_url=room_proxy_url,
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
from .responses_adapter import OpenAIResponsesAdapter, OpenAIResponsesToolResponseAdapter
|
|
2
|
-
from .completions_adapter import OpenAICompletionsAdapter, OpenAICompletionsToolResponseAdapter
|
|
2
|
+
from .completions_adapter import OpenAICompletionsAdapter, OpenAICompletionsToolResponseAdapter
|
|
3
|
+
from .stt import OpenAIAudioFileSTT, OpenAISTTToolkit
|
{meshagent_openai-0.0.30 → meshagent_openai-0.0.32}/meshagent/openai/tools/completions_adapter.py
RENAMED
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
from meshagent.agents.agent import
|
|
3
|
-
from meshagent.api import
|
|
2
|
+
from meshagent.agents.agent import AgentChatContext
|
|
3
|
+
from meshagent.api import RoomClient, RoomException
|
|
4
4
|
from meshagent.tools.blob import Blob, BlobStorage
|
|
5
|
-
from meshagent.tools import Toolkit, ToolContext
|
|
5
|
+
from meshagent.tools import Toolkit, ToolContext
|
|
6
6
|
from meshagent.api.messaging import Response, LinkResponse, FileResponse, JsonResponse, TextResponse, EmptyResponse
|
|
7
|
-
from meshagent.api.schema_util import prompt_schema
|
|
8
7
|
from meshagent.agents.adapter import ToolResponseAdapter, LLMAdapter
|
|
9
|
-
from uuid import uuid4
|
|
10
8
|
import json
|
|
11
|
-
from
|
|
12
|
-
from typing import List, Dict
|
|
9
|
+
from typing import List
|
|
13
10
|
|
|
14
11
|
from openai import AsyncOpenAI, APIStatusError
|
|
15
12
|
from openai.types.chat import ChatCompletion, ChatCompletionMessage, ChatCompletionMessageToolCall
|
|
16
13
|
|
|
17
|
-
from copy import deepcopy
|
|
18
|
-
from abc import abstractmethod, ABC
|
|
19
14
|
import os
|
|
20
|
-
import jsonschema
|
|
21
15
|
from typing import Optional, Any
|
|
22
16
|
|
|
23
17
|
import logging
|
|
24
18
|
import re
|
|
25
19
|
import asyncio
|
|
26
20
|
|
|
21
|
+
from meshagent.openai.proxy import get_client
|
|
22
|
+
|
|
27
23
|
logger = logging.getLogger("openai_agent")
|
|
28
24
|
|
|
29
25
|
|
|
@@ -234,7 +230,8 @@ class OpenAICompletionsAdapter(LLMAdapter):
|
|
|
234
230
|
)
|
|
235
231
|
|
|
236
232
|
return context
|
|
237
|
-
|
|
233
|
+
|
|
234
|
+
|
|
238
235
|
# Takes the current chat context, executes a completion request and processes the response.
|
|
239
236
|
# If a tool calls are requested, invokes the tools, processes the tool calls results, and appends the tool call results to the context
|
|
240
237
|
async def next(self,
|
|
@@ -249,23 +246,7 @@ class OpenAICompletionsAdapter(LLMAdapter):
|
|
|
249
246
|
tool_adapter = OpenAICompletionsToolResponseAdapter()
|
|
250
247
|
|
|
251
248
|
try:
|
|
252
|
-
|
|
253
|
-
openai = self._client
|
|
254
|
-
else:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
token : str = room.protocol.token
|
|
258
|
-
url : str = room.room_url
|
|
259
|
-
|
|
260
|
-
room_proxy_url = f"{url}/v1"
|
|
261
|
-
|
|
262
|
-
openai=AsyncOpenAI(
|
|
263
|
-
api_key=token,
|
|
264
|
-
base_url=room_proxy_url,
|
|
265
|
-
default_headers={
|
|
266
|
-
"Meshagent-Session" : room.session_id
|
|
267
|
-
}
|
|
268
|
-
)
|
|
249
|
+
openai = get_client(room=room)
|
|
269
250
|
|
|
270
251
|
tool_bundle = CompletionsToolBundle(toolkits=[
|
|
271
252
|
*toolkits,
|