Skip to content

Commit b30bed7

Browse files
Claudeowndev
andcommitted
Fix validation error with Azure AI Search data sources
Remove max_tokens and max_completion_tokens when data_sources are present. Azure AI Search "on your data" feature does not support token limit parameters. Fixes: "Validation error at #/max_completion_tokens: Extra inputs are not permitted" Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
1 parent 7d77d20 commit b30bed7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

pipelines/azure/azure_ai_foundry.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,20 @@ async def pipe(
16791679
if azure_ai_data_sources:
16801680
filtered_body["data_sources"] = azure_ai_data_sources
16811681

1682+
# Azure AI Search (data sources) does not support max_tokens or max_completion_tokens
1683+
# Remove these parameters to avoid validation errors when using "on your data" feature
1684+
if "data_sources" in filtered_body and filtered_body["data_sources"]:
1685+
if "max_tokens" in filtered_body:
1686+
filtered_body.pop("max_tokens")
1687+
log.debug(
1688+
"Removed max_tokens parameter (not supported with Azure AI Search data sources)"
1689+
)
1690+
if "max_completion_tokens" in filtered_body:
1691+
filtered_body.pop("max_completion_tokens")
1692+
log.debug(
1693+
"Removed max_completion_tokens parameter (not supported with Azure AI Search data sources)"
1694+
)
1695+
16821696
# Convert the modified body back to JSON
16831697
payload = json.dumps(filtered_body)
16841698

0 commit comments

Comments
 (0)