fusionkit-server 0.2.0__tar.gz → 0.3.1__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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fusionkit-server
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: OpenAI-compatible HTTP server for fusionkit.
5
5
  Requires-Dist: fastapi>=0.124.4
6
- Requires-Dist: fusionkit-core==0.2.0
6
+ Requires-Dist: fusionkit-core==0.3.1
7
7
  Requires-Dist: uvicorn>=0.38.0
8
8
  Requires-Dist: uvicorn[standard]>=0.38.0 ; extra == 'server'
9
9
  Requires-Python: >=3.11
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "fusionkit-server"
3
- version = "0.2.0"
3
+ version = "0.3.1"
4
4
  description = "OpenAI-compatible HTTP server for fusionkit."
5
5
  requires-python = ">=3.11"
6
6
  dependencies = [
7
7
  "fastapi>=0.124.4",
8
- "fusionkit-core==0.2.0",
8
+ "fusionkit-core==0.3.1",
9
9
  "uvicorn>=0.38.0",
10
10
  ]
11
11
 
@@ -153,13 +153,19 @@ def make_handler(endpoint: ModelEndpoint) -> type[BaseHTTPRequestHandler]:
153
153
  )
154
154
 
155
155
  async def run() -> Any:
156
+ # Build and close the client within this request's event
157
+ # loop so the SDK's HTTP connection pool is released instead
158
+ # of leaking a socket/file descriptor per request.
156
159
  client = build_client(endpoint)
157
- return await client.chat(
158
- messages,
159
- sampling,
160
- tools=tools,
161
- tool_choice=tool_choice if isinstance(tool_choice, str) else None,
162
- )
160
+ try:
161
+ return await client.chat(
162
+ messages,
163
+ sampling,
164
+ tools=tools,
165
+ tool_choice=tool_choice if isinstance(tool_choice, str) else None,
166
+ )
167
+ finally:
168
+ await client.aclose()
163
169
 
164
170
  started = time.perf_counter()
165
171
  response = asyncio.run(run())