@Bao, Jeremy (Cognizant) Yes, your understanding is correct. Using the requests
library in Python to make API calls is a common practice and it provides you with flexibility. The query_type
parameter in the data_sources
array in the request_body
JSON indeed allows you to specify the type of search you want to perform. The options ‘simple’, ‘semantic’, ‘vector’, ‘vectorSimpleHybrid’, and ‘vectorSemanticHybrid’ correspond to different types of searches you can perform with Azure OpenAI service.
Choosing Between Keyword Search, Vector Search, Keyword-Vector Hybrid Search, Semantic Search, and Keyword, Vector, Semantic Hybrid Search when doing RAG with Python SDK for Azure OpenAI
Bao, Jeremy (Cognizant)
105
Reputation points
If you want to do RAG just with simple keyword search, you do the following, right?:
response = client.chat.completions.create(
model = ...,
messages = ...,
extra_body = {
dataSources = [
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": ...,
"key": ...,
"indexName": ...,
}
}
]
}
)
The following is if you wish to do vector search, right? Does it do only vector search, or keyword-vector hybrid search? If it carries out one of those, how do you do the other type of search?
response = client.chat.completions.create(
model = ...,
messages = ...,
extra_body = {
dataSources = [
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": ...,
"key": ...,
"indexName": ...,
"vectorProfile": ...,
"vectorField": ...
}
}
]
}
)
How would you modify this to do semantic search and keyword, vector, and semantic hybrid search?
Accepted answer
-
navba-MSFT 20,810 Reputation points Microsoft Employee
2024-04-09T05:00:33.2133333+00:00