dora-openai-server 0.3.7rc2__py3-none-any.whl → 0.3.9__py3-none-any.whl
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.
- dora_openai_server/__init__.py +1 -1
- dora_openai_server/main.py +10 -17
- dora_openai_server-0.3.9.dist-info/METADATA +21 -0
- dora_openai_server-0.3.9.dist-info/RECORD +7 -0
- {dora_openai_server-0.3.7rc2.dist-info → dora_openai_server-0.3.9.dist-info}/WHEEL +2 -1
- dora_openai_server-0.3.9.dist-info/entry_points.txt +2 -0
- dora_openai_server-0.3.9.dist-info/top_level.txt +1 -0
- dora_openai_server-0.3.7rc2.dist-info/METADATA +0 -34
- dora_openai_server-0.3.7rc2.dist-info/RECORD +0 -6
- dora_openai_server-0.3.7rc2.dist-info/entry_points.txt +0 -3
dora_openai_server/__init__.py
CHANGED
@@ -5,7 +5,7 @@ readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.m
|
|
5
5
|
|
6
6
|
# Read the content of the README file
|
7
7
|
try:
|
8
|
-
with open(readme_path,
|
8
|
+
with open(readme_path, encoding="utf-8") as f:
|
9
9
|
__doc__ = f.read()
|
10
10
|
except FileNotFoundError:
|
11
11
|
__doc__ = "README file not found."
|
dora_openai_server/main.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import ast
|
2
|
+
import asyncio
|
3
3
|
from typing import List, Optional
|
4
|
+
|
5
|
+
import pyarrow as pa
|
4
6
|
import uvicorn
|
5
7
|
from dora import Node
|
6
|
-
import
|
7
|
-
|
8
|
-
import ast
|
8
|
+
from fastapi import FastAPI
|
9
|
+
from pydantic import BaseModel
|
9
10
|
|
10
11
|
DORA_RESPONSE_TIMEOUT = 10
|
11
12
|
app = FastAPI()
|
@@ -55,13 +56,7 @@ async def create_chat_completion(request: ChatCompletionRequest):
|
|
55
56
|
print("Passing input as string")
|
56
57
|
if isinstance(data, list):
|
57
58
|
data = pa.array(data) # initialize pyarrow array
|
58
|
-
elif isinstance(data, str):
|
59
|
-
data = pa.array([data])
|
60
|
-
elif isinstance(data, int):
|
61
|
-
data = pa.array([data])
|
62
|
-
elif isinstance(data, float):
|
63
|
-
data = pa.array([data])
|
64
|
-
elif isinstance(data, dict):
|
59
|
+
elif isinstance(data, str) or isinstance(data, int) or isinstance(data, float) or isinstance(data, dict):
|
65
60
|
data = pa.array([data])
|
66
61
|
else:
|
67
62
|
data = pa.array(data) # initialize pyarrow array
|
@@ -73,12 +68,10 @@ async def create_chat_completion(request: ChatCompletionRequest):
|
|
73
68
|
if event["type"] == "ERROR":
|
74
69
|
response_str = "No response received. Err: " + event["value"][0].as_py()
|
75
70
|
break
|
76
|
-
|
71
|
+
if event["type"] == "INPUT" and event["id"] == "v1/chat/completions":
|
77
72
|
response = event["value"]
|
78
73
|
response_str = response[0].as_py() if response else "No response received"
|
79
74
|
break
|
80
|
-
else:
|
81
|
-
pass
|
82
75
|
|
83
76
|
return ChatCompletionResponse(
|
84
77
|
id="chatcmpl-1234",
|
@@ -90,7 +83,7 @@ async def create_chat_completion(request: ChatCompletionRequest):
|
|
90
83
|
"index": 0,
|
91
84
|
"message": {"role": "assistant", "content": response_str},
|
92
85
|
"finish_reason": "stop",
|
93
|
-
}
|
86
|
+
},
|
94
87
|
],
|
95
88
|
usage={
|
96
89
|
"prompt_tokens": len(data),
|
@@ -110,7 +103,7 @@ async def list_models():
|
|
110
103
|
"object": "model",
|
111
104
|
"created": 1677610602,
|
112
105
|
"owned_by": "openai",
|
113
|
-
}
|
106
|
+
},
|
114
107
|
],
|
115
108
|
}
|
116
109
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: dora-openai-server
|
3
|
+
Version: 0.3.9
|
4
|
+
Summary: Dora OpenAI API Server
|
5
|
+
Author-email: Haixuan Xavier Tao <tao.xavier@outlook.com>, Enzo Le Van <dev@enzo-le-van.fr>
|
6
|
+
License: MIT
|
7
|
+
Requires-Python: >=3.8
|
8
|
+
Description-Content-Type: text/markdown
|
9
|
+
Requires-Dist: dora-rs>=0.3.6
|
10
|
+
Requires-Dist: numpy<2.0.0
|
11
|
+
Requires-Dist: pyarrow>=5.0.0
|
12
|
+
Requires-Dist: fastapi>=0.115
|
13
|
+
Requires-Dist: asyncio>=3.4
|
14
|
+
Requires-Dist: uvicorn>=0.31
|
15
|
+
Requires-Dist: pydantic>=2.9
|
16
|
+
|
17
|
+
# Dora OpenAI Server
|
18
|
+
|
19
|
+
This is an experimental to expose an openai server endpoint with dora.
|
20
|
+
|
21
|
+
Check example at [examples/openai-server](../../examples/openai-server/README.md)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
dora_openai_server/__init__.py,sha256=HuSK3dnyI9Pb5QAuaKFwQQ3J5SIZnLcKHPJO0norGzc,353
|
2
|
+
dora_openai_server/main.py,sha256=s9N-ruIUFcCMVAXyKVZsEKMxYkCaN4yZzA--EhIhpm8,3385
|
3
|
+
dora_openai_server-0.3.9.dist-info/METADATA,sha256=jSrYPqtx_hfn2xGMGyZuYq_Wkq2DA_uOMcJdcf9_ODs,642
|
4
|
+
dora_openai_server-0.3.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
+
dora_openai_server-0.3.9.dist-info/entry_points.txt,sha256=d8EfbKX3cKlpphEAXvq47yK8wnC32GURTrn5PM3F_Js,68
|
6
|
+
dora_openai_server-0.3.9.dist-info/top_level.txt,sha256=eISRjpcIXoox34EZVT9C3ccqVT5SsPxboJjIhDePq1Y,19
|
7
|
+
dora_openai_server-0.3.9.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
dora_openai_server
|
@@ -1,34 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: dora-openai-server
|
3
|
-
Version: 0.3.7rc2
|
4
|
-
Summary: Dora OpenAI API Server
|
5
|
-
Home-page: https://github.com/dora-rs/dora.git
|
6
|
-
License: MIT
|
7
|
-
Author: Haixuan Xavier Tao
|
8
|
-
Author-email: tao.xavier@outlook.com
|
9
|
-
Requires-Python: >=3.7,<4.0
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Programming Language :: Python :: 3.7
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
19
|
-
Requires-Dist: asyncio (>=3.4,<4.0)
|
20
|
-
Requires-Dist: dora-rs (>=0.3.6,<0.4.0)
|
21
|
-
Requires-Dist: fastapi (>=0.115,<0.116)
|
22
|
-
Requires-Dist: numpy (<2.0.0)
|
23
|
-
Requires-Dist: pyarrow (>=5.0.0)
|
24
|
-
Requires-Dist: pydantic (>=2.9,<3.0)
|
25
|
-
Requires-Dist: uvicorn (>=0.31,<0.32)
|
26
|
-
Project-URL: Documentation, https://github.com/dora-rs/dora/blob/main/node-hub/dora-openai-server/README.md
|
27
|
-
Description-Content-Type: text/markdown
|
28
|
-
|
29
|
-
# Dora OpenAI Server
|
30
|
-
|
31
|
-
This is an experimental to expose an openai server endpoint with dora.
|
32
|
-
|
33
|
-
Check example at [examples/openai-server](../../examples/openai-server/README.md)
|
34
|
-
|
@@ -1,6 +0,0 @@
|
|
1
|
-
dora_openai_server/__init__.py,sha256=Gy4qL4vCeTyA5HR1Yp3ioL4-ClJyW8oi_38CzMuMsBM,358
|
2
|
-
dora_openai_server/main.py,sha256=1TEl9UZYF9DKY9PLMJRdiSAKL7Q5FzaRtE0h09XgaX4,3532
|
3
|
-
dora_openai_server-0.3.7rc2.dist-info/METADATA,sha256=uIsmXMncE71ZvqyofRfyxRkqLxniEE342eJQG7aFrpk,1282
|
4
|
-
dora_openai_server-0.3.7rc2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
5
|
-
dora_openai_server-0.3.7rc2.dist-info/entry_points.txt,sha256=StRfCXeKJyyyd5MzPWZKNm7HS0rP1KLsKCUZSEDBRF4,67
|
6
|
-
dora_openai_server-0.3.7rc2.dist-info/RECORD,,
|