Skip to content

General SearchClient using azure.search.documents.aio and Vector search question/issue #917

@TroyHostetter

Description

@TroyHostetter

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I am attempting to replicate one of the Cognitive Search queries used by the cookbook, and have this line of code that is nearly identical to the cookbook:

    r =  await search_client.search(query_text, 
                            filter=None,
                            top=3, 
                            vector=query_vector, 
                            top_k=50 if query_vector else None, 
                            vector_fields="embedding" if query_vector else None,
                            logging_enable=True)

I have verified that query_vector does indeed contain a valid embeddings object returned from the openai Embeddings call.

my imports looks like this:

import os
import traceback
import sys
import logging
import asyncio
import openai
from azure.identity.aio import AzureDeveloperCliCredential
from azure.search.documents.aio import SearchClient
from modules.MessageBuilder import MessageBuilder

As an aside, I am able to get the document count in Search by calling this search method:

async def get_count(search_client: SearchClient):
    count = await search_client.get_document_count()
    return count

Any log messages given by the failure

I am receiving this error, which seems to indicate "vector" is not a valid parameter for search.

TypeError: ClientSession._request() got an unexpected keyword argument 'vector'

Expected/desired behavior

Search should execute the query

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Windows 11 + Python 3.11.3

azd version?

run azd version and copy paste here.
azd version 1.0.1

Versions

Name: openai Version: 0.28.1
Name: azure-identity Version: 1.15.0
Name: azure-search-documents Version: 11.3.0

Mention any other details that might be useful

I realize this is not an official bug with your code, but was curious if you knew what may cause this issue? Thanks for any help you are willing to provide.


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions