I have an Azure Cognitive Search index that I connected to Azure OpenAI through the extra_body parameter. Everything was working great until I added a tag scoring profile to my index.
The scoring profile boosts documents that have “magnesium” in the SUPPLEMENTS field by 8 times. But now when I try to run my chat completion, it throws an error saying it needs a scoringParameter.
Here’s my working code before adding the scoring profile:
response = openai_client.chat.completions.create(
model=deployment_name,
messages=user_messages,
temperature=0.3,
extra_body={
"data_sources": [{
"type": "azure_search",
"parameters": {
"endpoint": search_endpoint,
"index_name": my_index,
"semantic_configuration": semantic_config,
"query_type": "hybrid",
"in_scope": True,
"role_information": None,
"strictness": 2,
"top_n_documents": 5,
"authentication": {
"type": "api_key",
"key": search_key
},
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": embedding_model
}
}
}]
}
)
After enabling the default scoring profile, I get this error: “Expected 1 parameter(s) but 0 were supplied. Parameter name: scoringParameter”
When I try adding scoringParameter to the parameters section, I get “Extra inputs are not permitted”.
My tag scoring profile looks like this:
profile = ScoringProfile(
name="supplement-boost-profile",
functions=[
TagScoringFunction(
field_name="SUPPLEMENTS",
boost=8.0,
parameters=TagScoringParameters(
tags_parameter="supplement_tags"
)
)
]
)
Where exactly should I put the scoring parameters in the extra_body structure? The documentation is not clear about this specific use case with OpenAI integration.