dify-player 0.3.3__tar.gz → 0.3.4__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.
- {dify_player-0.3.3 → dify_player-0.3.4}/PKG-INFO +1 -1
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/__init__.py +1 -1
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/llm_groq_chat.py +63 -7
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player.egg-info/PKG-INFO +1 -1
- {dify_player-0.3.3 → dify_player-0.3.4}/pyproject.toml +1 -1
- {dify_player-0.3.3 → dify_player-0.3.4}/MANIFEST.in +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/README.md +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/__main__.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/cli.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/__init__.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/graph_parser.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/http_body_converter.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/__init__.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/assigner.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/code.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/end.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/http_request.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/if_else.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/llm.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/loop.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/start.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/template_transform.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/variable_aggregator.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/plan_serializer.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/reference_converter.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/workflow_loader.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/workflow_normalizer.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_workflow_importer.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/event_logger.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/exceptions.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/input_resolver.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/llm_cache.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/models.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/__init__.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/assigner.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/code.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/end.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/http.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/if_else.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/llm_azure_chat.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/llm_xai_chat.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/start.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/template.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/nodes/variable_aggregator.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/plan_loader.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/runtime.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/value_renderer.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/workflow_engine.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player/workflow_executor.py +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player.egg-info/SOURCES.txt +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player.egg-info/dependency_links.txt +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player.egg-info/requires.txt +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/dify_player.egg-info/top_level.txt +0 -0
- {dify_player-0.3.3 → dify_player-0.3.4}/setup.cfg +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import os
|
|
4
5
|
from typing import Any
|
|
5
6
|
|
|
@@ -158,13 +159,38 @@ async def _run_structured_output_with_repair(
|
|
|
158
159
|
latest_metadata = {"usage": _zero_usage(), "finish_reason": None}
|
|
159
160
|
|
|
160
161
|
for attempt_index in range(_STRUCTURED_OUTPUT_REPAIR_RETRIES + 1):
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
try:
|
|
163
|
+
raw_text, metadata = await _request_raw_text(
|
|
164
|
+
node=node,
|
|
165
|
+
base_url=base_url,
|
|
166
|
+
api_key=api_key,
|
|
167
|
+
messages=current_messages,
|
|
168
|
+
http_client=http_client,
|
|
169
|
+
)
|
|
170
|
+
except GroqLLMBadStatusError as exc:
|
|
171
|
+
failed_generation = _extract_groq_failed_generation(exc)
|
|
172
|
+
if failed_generation is None:
|
|
173
|
+
raise
|
|
174
|
+
|
|
175
|
+
validation_error, raw_text = failed_generation
|
|
176
|
+
attempts.append(
|
|
177
|
+
{
|
|
178
|
+
"attempt": str(attempt_index + 1),
|
|
179
|
+
"error": validation_error,
|
|
180
|
+
"raw_text": raw_text,
|
|
181
|
+
"provider_status_code": str(exc.status_code),
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
if attempt_index >= _STRUCTURED_OUTPUT_REPAIR_RETRIES:
|
|
185
|
+
raise GroqLLMStructuredOutputError(
|
|
186
|
+
f"{validation_error} after {attempt_index + 1} attempts",
|
|
187
|
+
attempts=attempts,
|
|
188
|
+
) from exc
|
|
189
|
+
current_messages = current_messages + [
|
|
190
|
+
_build_repair_message(validation_error=validation_error, previous_output=raw_text)
|
|
191
|
+
]
|
|
192
|
+
continue
|
|
193
|
+
|
|
168
194
|
aggregated_usage = _merge_usage(aggregated_usage, metadata["usage"])
|
|
169
195
|
latest_metadata = metadata
|
|
170
196
|
try:
|
|
@@ -195,6 +221,36 @@ async def _run_structured_output_with_repair(
|
|
|
195
221
|
raise AssertionError("structured output repair loop must return or raise")
|
|
196
222
|
|
|
197
223
|
|
|
224
|
+
# Groq may return json_validate_failed as HTTP 400 even when the failure is the
|
|
225
|
+
# model's generated JSON, not a permanent request/schema error. Preserve that
|
|
226
|
+
# failed output so the existing structured-output repair prompt can fix it.
|
|
227
|
+
def _extract_groq_failed_generation(exc: GroqLLMBadStatusError) -> tuple[str, str] | None:
|
|
228
|
+
if exc.status_code != 400 or exc.response_body is None:
|
|
229
|
+
return None
|
|
230
|
+
|
|
231
|
+
try:
|
|
232
|
+
payload = json.loads(exc.response_body)
|
|
233
|
+
except json.JSONDecodeError:
|
|
234
|
+
return None
|
|
235
|
+
if not isinstance(payload, dict):
|
|
236
|
+
return None
|
|
237
|
+
|
|
238
|
+
error = payload.get("error")
|
|
239
|
+
if not isinstance(error, dict):
|
|
240
|
+
return None
|
|
241
|
+
if error.get("code") != "json_validate_failed":
|
|
242
|
+
return None
|
|
243
|
+
|
|
244
|
+
failed_generation = error.get("failed_generation")
|
|
245
|
+
if not isinstance(failed_generation, str) or not failed_generation.strip():
|
|
246
|
+
return None
|
|
247
|
+
|
|
248
|
+
message = error.get("message")
|
|
249
|
+
if not isinstance(message, str) or not message:
|
|
250
|
+
message = "Groq json_validate_failed"
|
|
251
|
+
return message, failed_generation
|
|
252
|
+
|
|
253
|
+
|
|
198
254
|
def _build_llm_output(
|
|
199
255
|
*,
|
|
200
256
|
text: str,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/__init__.py
RENAMED
|
File without changes
|
{dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/assigner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/http_request.py
RENAMED
|
File without changes
|
{dify_player-0.3.3 → dify_player-0.3.4}/dify_player/dify_importer/node_converters/if_else.py
RENAMED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|