local-openai2anthropic 0.3.0__py3-none-any.whl → 0.3.1__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.
@@ -61,6 +61,10 @@ async def _stream_response(
61
61
  """
62
62
  Stream response from OpenAI and convert to Anthropic format.
63
63
  """
64
+ # Log streaming request start
65
+ logger.info(f"[OpenAI Stream] Starting streaming request to {url}")
66
+ logger.info(f"[OpenAI Stream] Request model: {json_data.get('model', 'unknown')}")
67
+
64
68
  try:
65
69
  async with client.stream(
66
70
  "POST", url, headers=headers, json=json_data
@@ -269,13 +273,18 @@ async def _stream_response(
269
273
  # Handle new tool call (with id) - use separate if, not elif
270
274
  # because a chunk may have both id AND arguments
271
275
  if tool_call.get("id"):
276
+ func = tool_call.get("function") or {}
277
+ tool_name = func.get("name", "")
278
+ logger.info(
279
+ f"[OpenAI Stream] Tool call started - id={tool_call['id']}, name={tool_name}"
280
+ )
281
+
272
282
  if content_block_started:
273
283
  yield f"event: content_block_stop\ndata: {json.dumps({'type': 'content_block_stop', 'index': content_block_index})}\n\n"
274
284
  content_block_started = False
275
285
  content_block_index += 1
276
286
 
277
- func = tool_call.get("function") or {}
278
- yield f"event: content_block_start\ndata: {json.dumps({'type': 'content_block_start', 'index': content_block_index, 'content_block': {'type': 'tool_use', 'id': tool_call['id'], 'name': func.get('name', ''), 'input': {}}})}\n\n"
287
+ yield f"event: content_block_start\ndata: {json.dumps({'type': 'content_block_start', 'index': content_block_index, 'content_block': {'type': 'tool_use', 'id': tool_call['id'], 'name': tool_name, 'input': {}}})}\n\n"
279
288
  content_block_started = True
280
289
  current_block_type = "tool_use"
281
290
 
@@ -296,6 +305,13 @@ async def _stream_response(
296
305
  )
297
306
  yield f"event: content_block_stop\ndata: {json.dumps(stop_block)}\n\n"
298
307
 
308
+ # Log stream summary before ending
309
+ logger.info(
310
+ f"[OpenAI Stream] Stream ended - message_id={message_id}, "
311
+ f"finish_reason={finish_reason}, input_tokens={input_tokens}, "
312
+ f"output_tokens={output_tokens}, content_blocks={content_block_index + 1}"
313
+ )
314
+
299
315
  # Message stop
300
316
  stop_event = {"type": "message_stop"}
301
317
  logger.debug(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: local-openai2anthropic
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A lightweight proxy server that converts Anthropic Messages API to OpenAI API
5
5
  Project-URL: Homepage, https://github.com/dongfangzan/local-openai2anthropic
6
6
  Project-URL: Repository, https://github.com/dongfangzan/local-openai2anthropic
@@ -7,13 +7,13 @@ local_openai2anthropic/daemon_runner.py,sha256=rguOH0PgpbjqNsKYei0uCQX8JQOQ1wmtQ
7
7
  local_openai2anthropic/main.py,sha256=FK5JBBpzB_T44y3N16lPl1hK4ht4LEQqRKzVmkIjIoo,9866
8
8
  local_openai2anthropic/openai_types.py,sha256=jFdCvLwtXYoo5gGRqOhbHQcVaxcsxNnCP_yFPIv7rG4,3823
9
9
  local_openai2anthropic/protocol.py,sha256=vUEgxtRPFll6jEtLc4DyxTLCBjrWIEScZXhEqe4uibk,5185
10
- local_openai2anthropic/router.py,sha256=ci8G3XL3eHzpn3kOko5QhnqLtIQTrlAaIhvzrvuk_Jc,46271
10
+ local_openai2anthropic/router.py,sha256=jS6-IvAHNYhyGYhR0gJ-wm0Je0Jtkt-e5ca4hnmG3GM,47015
11
11
  local_openai2anthropic/tavily_client.py,sha256=QsBhnyF8BFWPAxB4XtWCCpHCquNL5SW93-zjTTi4Meg,3774
12
12
  local_openai2anthropic/server_tools/__init__.py,sha256=QlJfjEta-HOCtLe7NaY_fpbEKv-ZpInjAnfmSqE9tbk,615
13
13
  local_openai2anthropic/server_tools/base.py,sha256=pNFsv-jSgxVrkY004AHAcYMNZgVSO8ZOeCzQBUtQ3vU,5633
14
14
  local_openai2anthropic/server_tools/web_search.py,sha256=1C7lX_cm-tMaN3MsCjinEZYPJc_Hj4yAxYay9h8Zbvs,6543
15
- local_openai2anthropic-0.3.0.dist-info/METADATA,sha256=e8dCKWpeT7dth6tqLfW7RvRaJxrUUr4DRg3OJDc3MBI,11240
16
- local_openai2anthropic-0.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- local_openai2anthropic-0.3.0.dist-info/entry_points.txt,sha256=hdc9tSJUNxyNLXcTYye5SuD2K0bEQhxBhGnWTFup6ZM,116
18
- local_openai2anthropic-0.3.0.dist-info/licenses/LICENSE,sha256=X3_kZy3lJvd_xp8IeyUcIAO2Y367MXZc6aaRx8BYR_s,11369
19
- local_openai2anthropic-0.3.0.dist-info/RECORD,,
15
+ local_openai2anthropic-0.3.1.dist-info/METADATA,sha256=3NC5cFpYZ_EqOZ5Adoeq1wPqqXIcE8UoKDGxL7vkGGg,11240
16
+ local_openai2anthropic-0.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ local_openai2anthropic-0.3.1.dist-info/entry_points.txt,sha256=hdc9tSJUNxyNLXcTYye5SuD2K0bEQhxBhGnWTFup6ZM,116
18
+ local_openai2anthropic-0.3.1.dist-info/licenses/LICENSE,sha256=X3_kZy3lJvd_xp8IeyUcIAO2Y367MXZc6aaRx8BYR_s,11369
19
+ local_openai2anthropic-0.3.1.dist-info/RECORD,,