Skip to content

Got Multiple Values for Keyword Argument 'k' in as_retriever Function #22969

Answered by dosubot bot
Panegyric0926 asked this question in Q&A
Discussion options

You must be logged in to vote

@Panegyric0926 Hello there! I'm here to help you with any bugs, questions, or contributions you might have. Let's tackle this together!

To resolve the TypeError: langchain_community.vectorstores.azuresearch.AzureSearch.vector_search() got multiple values for keyword argument 'k' error and ensure that 8 documents are returned, you need to set the k parameter directly in the as_retriever function without including it in the search_kwargs.

Here's the corrected code:

from langchain_openai import AzureChatOpenAI
from langchain_openai import AzureOpenAIEmbeddings
from langchain.vectorstores.azuresearch import AzureSearch
from langchain.chains import RetrievalQA

llm = AzureChatOpenAI(deploymen…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@JuliaZamaitat
Comment options

@PPraneesh
Comment options

@ibrahoss
Comment options

@ibrahoss
Comment options

Answer selected by Panegyric0926
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants