mycode-sdk 0.7.2__tar.gz → 0.7.3__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.
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/PKG-INFO +1 -1
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/pyproject.toml +1 -1
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/base.py +1 -1
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/openai_chat.py +32 -11
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/.gitignore +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/LICENSE +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/README.md +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/__init__.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/agent.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/hooks.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/messages.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/models.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/models_catalog.json +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/__init__.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/anthropic_like.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/gemini.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/providers/openai_responses.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/py.typed +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/session.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/tools.py +0 -0
- {mycode_sdk-0.7.2 → mycode_sdk-0.7.3}/src/mycode/utils.py +0 -0
|
@@ -205,7 +205,7 @@ def repair_messages_for_replay(
|
|
|
205
205
|
block_type = raw_block.get("type")
|
|
206
206
|
if block_type in {"text", "thinking"}:
|
|
207
207
|
text = str(raw_block.get("text") or "")
|
|
208
|
-
if text:
|
|
208
|
+
if text or get_native_meta(raw_block):
|
|
209
209
|
content.append(dict(raw_block))
|
|
210
210
|
continue
|
|
211
211
|
|
|
@@ -79,9 +79,10 @@ class OpenAIChatAdapter(ProviderAdapter):
|
|
|
79
79
|
|
|
80
80
|
delta = choice.delta
|
|
81
81
|
reasoning_delta, reasoning_meta_update = self._extract_reasoning_delta(delta)
|
|
82
|
+
if reasoning_meta_update:
|
|
83
|
+
thinking_native_meta.update(reasoning_meta_update)
|
|
82
84
|
if reasoning_delta:
|
|
83
85
|
thinking_parts.append(reasoning_delta)
|
|
84
|
-
thinking_native_meta.update(reasoning_meta_update)
|
|
85
86
|
yield ProviderStreamEvent("thinking_delta", {"text": reasoning_delta})
|
|
86
87
|
|
|
87
88
|
if delta.content:
|
|
@@ -104,7 +105,7 @@ class OpenAIChatAdapter(ProviderAdapter):
|
|
|
104
105
|
raise ValueError(str(exc)) from exc
|
|
105
106
|
|
|
106
107
|
blocks = []
|
|
107
|
-
if thinking_parts:
|
|
108
|
+
if thinking_parts or thinking_native_meta:
|
|
108
109
|
blocks.append(
|
|
109
110
|
thinking_block(
|
|
110
111
|
"".join(thinking_parts),
|
|
@@ -286,32 +287,52 @@ class OpenAIChatAdapter(ProviderAdapter):
|
|
|
286
287
|
reasoning_field = str(native_meta.get("reasoning_field") or "")
|
|
287
288
|
if reasoning_field == "reasoning_details":
|
|
288
289
|
return {"reasoning_details": native_meta.get("reasoning_details") or []}
|
|
290
|
+
if reasoning_field == "reasoning":
|
|
291
|
+
return {"reasoning": thinking_text or None}
|
|
292
|
+
if reasoning_field == "reasoning_content":
|
|
293
|
+
return {"reasoning_content": thinking_text or None}
|
|
289
294
|
return {"reasoning_content": thinking_text} if thinking_text else {}
|
|
290
295
|
|
|
291
296
|
def _extract_reasoning_delta(self, delta: Any) -> tuple[str, dict[str, Any]]:
|
|
292
297
|
# Third-party providers surface reasoning through non-standard extras.
|
|
293
298
|
# We check both the delta root and model_extra to cover both patterns.
|
|
294
|
-
# Known fields: reasoning_content
|
|
299
|
+
# Known fields: reasoning, reasoning_content, reasoning_details.
|
|
295
300
|
for source in (delta, getattr(delta, "model_extra", None) or {}):
|
|
296
301
|
if isinstance(source, dict):
|
|
302
|
+
has_reasoning = "reasoning" in source
|
|
303
|
+
reasoning = source.get("reasoning")
|
|
304
|
+
has_reasoning_content = "reasoning_content" in source
|
|
297
305
|
reasoning_content = source.get("reasoning_content")
|
|
306
|
+
has_reasoning_details = "reasoning_details" in source
|
|
298
307
|
reasoning_details = source.get("reasoning_details")
|
|
299
308
|
else:
|
|
309
|
+
has_reasoning = hasattr(source, "reasoning")
|
|
310
|
+
reasoning = getattr(source, "reasoning", None)
|
|
311
|
+
has_reasoning_content = hasattr(source, "reasoning_content")
|
|
300
312
|
reasoning_content = getattr(source, "reasoning_content", None)
|
|
313
|
+
has_reasoning_details = hasattr(source, "reasoning_details")
|
|
301
314
|
reasoning_details = getattr(source, "reasoning_details", None)
|
|
302
315
|
|
|
303
|
-
if
|
|
304
|
-
return
|
|
316
|
+
if has_reasoning:
|
|
317
|
+
return (
|
|
318
|
+
reasoning if isinstance(reasoning, str) else "",
|
|
319
|
+
{"reasoning_field": "reasoning"},
|
|
320
|
+
)
|
|
305
321
|
|
|
306
|
-
if
|
|
322
|
+
if has_reasoning_content:
|
|
323
|
+
return (
|
|
324
|
+
reasoning_content if isinstance(reasoning_content, str) else "",
|
|
325
|
+
{"reasoning_field": "reasoning_content"},
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
if has_reasoning_details and isinstance(reasoning_details, list):
|
|
307
329
|
reasoning_text = "".join(
|
|
308
330
|
str(item.get("text") or "") for item in reasoning_details if isinstance(item, dict)
|
|
309
331
|
)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
332
|
+
return reasoning_text, {
|
|
333
|
+
"reasoning_field": "reasoning_details",
|
|
334
|
+
"reasoning_details": reasoning_details,
|
|
335
|
+
}
|
|
315
336
|
|
|
316
337
|
return "", {}
|
|
317
338
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|