azure ai search
2 TopicsAzure AI Search - Tag Scoring profile on azureopenai extra_body
I created an index on Azure AI Search and connected it to Azure OpenAI using the extra_body. It works perfectly. However, I created a default scoring profile for my index, which boosts documents containing the string "zinc" in the VITAMINS field by a factor of 10. Since doing this, I can no longer run the query that worked previously without issues. Now, the query is asking for a scoringParameter, and when I attempt to pass it, I receive an error. Here is the code that works fine when I remove the scoring function. client.chat.completions.create( model=os.getenv('DEPLOYMENT'), messages=messages, temperature=0.5, extra_body={ "data_sources": [{ "type": "azure_search", "parameters": { "endpoint": os.getenv('ENDPOINT'), "index_name": os.getenv('INDEX'), "semantic_configuration": os.getenv('RANK'), "query_type": "hybrid", "in_scope": True, "role_information": None, "strictness": 1, "top_n_documents": 3, "authentication": { "type": "api_key", "key": os.getenv('KEY') }, "embedding_dependency": { "type": "deployment_name", "deployment_name": os.getenv('ADA_VIT') } } }] } ) However, if I activate the default scoring profile, I get the following error: > An error occurred: Error code: 400 - {'error': 'message': 'An error occurred when calling Azure Cognitive Search: Azure Search Error: 400, message=\'Server responded with status 400. Error message: {"error":{"code":"MissingRequiredParameter","message":"Expected 1 parameter(s) but 0 were supplied.\\\\r\\\\nParameter name: scoringParameter","details":[{"code":"MissingScoringParameter","message":"Expected 1 parameter(s) but 0 were supplied."}]}}\', api-version=2024-03-01-preview\'\nCall to Azure Search instance failed.\nAPI Users: Please ensure you are using the right instance, index_name, and provide admin_key as the api_key.\n'} **If I try to pass the scoringParameter anywhere in the extra_body**, I receive this error: > An error occurred: Error code: 400 - {'error': {'requestid': '', 'code': 400, 'message': 'Validation error at #/data_sources/0/azure_search/parameters/scoringParameter: Extra inputs are not permitted'}} This error is even more confusing. I’ve been looking through various resources, but none of them seem to provide a clear example of how to properly pass the scoring profile or scoring parameters in the extra_body. Here’s how I define my scoring profile using tags: scoring_profiles = [ ScoringProfile( name="my-scoring-profile", functions=[ TagScoringFunction( field_name="VITAMINS", boost=10.0, parameters=TagScoringParameters( tags_parameter="tags", ), ) ] ) ] How to pass the scoring parameters correctly in the `extra_body` on the `client.chat.completions.create`? PS: The only way I can get my code to work is if I delete the scoring profile or do not make it the scoring profile by default by I do want to use it.420Views0likes5CommentsEnable Semantic Search on ACA Index - configuration fields
When you enable the Semantic Search on existing Indexes, you need configure the fields to a better result. What are some general guidance or recommendation for the common fields you usually configure? Let’s say your indexes is built against Confluence pages or SharePoint Document Libraries (PDF, Office files, text, etc). Thanks!570Views0likes0Comments