Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: Provider cohere model does not support chat. #28174

Open
5 tasks done
Anirudh31415926535 opened this issue Nov 18, 2024 · 0 comments
Open
5 tasks done
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@Anirudh31415926535
Copy link
Contributor

Anirudh31415926535 commented Nov 18, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

text = "One of the most powerful applications enabled by LLMs is sophisticated question-answering (Q&A) chatbots. These are applications that can answer questions about specific source information. These applications use a technique known as Retrieval Augmented Generation, or RAG. This tutorial will show how to build a simple Q&A application over a text data source. Along the way we’ll go over a typical Q&A architecture and highlight additional resources for more advanced Q&A techniques. We’ll also see how LangSmith can help us trace and understand our application. LangSmith will become increasingly helpful as our application grows in complexity."



bedrock_runtime = boto3.client(service_name= "bedrock-runtime", region_name= "us-east-1")

llm = ChatBedrock(client=bedrock_runtime,
    model_id="cohere.command-r-plus-v1:0",
)

text_splitter = RecursiveCharacterTextSplitter(chunk_size=20, chunk_overlap=5)
splits = text_splitter.split_text(text)
vectorstore = Chroma.from_texts(texts=splits, embedding=BedrockEmbeddings(model_id="amazon.titan-embed-text-v1", region_name=""))
retriever = vectorstore.as_retriever()

prompt_template=PromptTemplate(
            template=""" Use the following context: {context} to answer the question : {question}""",
            input_variables=["context", "question"])

qa_chain = RetrievalQA.from_chain_type(
            llm=llm,
            retriever=retriever,
            return_source_documents=True,
            chain_type_kwargs={
                "prompt": prompt_template,
            },
            chain_type="stuff",
        )

qa_chain.invoke({"query": "What is LLM"})

Error Message and Stack Trace (if applicable)

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[18], [line 30](vscode-notebook-cell:?execution_count=18&line=30)
     [16](vscode-notebook-cell:?execution_count=18&line=16) prompt_template=PromptTemplate(
     [17](vscode-notebook-cell:?execution_count=18&line=17)             template=""" Use the following context: {context} to answer the question : {question}""",
     [18](vscode-notebook-cell:?execution_count=18&line=18)             input_variables=["context", "question"])
     [20](vscode-notebook-cell:?execution_count=18&line=20) qa_chain = RetrievalQA.from_chain_type(
     [21](vscode-notebook-cell:?execution_count=18&line=21)             llm=llm,
     [22](vscode-notebook-cell:?execution_count=18&line=22)             retriever=retriever,
   (...)
     [27](vscode-notebook-cell:?execution_count=18&line=27)             chain_type="stuff",
     [28](vscode-notebook-cell:?execution_count=18&line=28)         )
---> [30](vscode-notebook-cell:?execution_count=18&line=30) qa_chain.invoke({"query": "What is LLM"})

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166, in Chain.invoke(self, input, config, **kwargs)
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:
    [165](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:165)     run_manager.on_chain_error(e)
--> [166](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166)     raise e
    [167](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:167) run_manager.on_chain_end(outputs)
    [169](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:169) if include_run_info:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156, in Chain.invoke(self, input, config, **kwargs)
    [153](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:153) try:
    [154](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:154)     self._validate_inputs(inputs)
    [155](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:155)     outputs = (
--> [156](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156)         self._call(inputs, run_manager=run_manager)
    [157](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:157)         if new_arg_supported
    [158](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:158)         else self._call(inputs)
    [159](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:159)     )
    [161](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:161)     final_outputs: Dict[str, Any] = self.prep_outputs(
    [162](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:162)         inputs, outputs, return_only_outputs
    [163](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:163)     )
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:145, in BaseRetrievalQA._call(self, inputs, run_manager)
    [143](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:143) else:
    [144](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:144)     docs = self._get_docs(question)  # type: ignore[call-arg]
--> [145](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:145) answer = self.combine_documents_chain.run(
    [146](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:146)     input_documents=docs, question=question, callbacks=_run_manager.get_child()
    [147](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:147) )
    [149](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:149) if self.return_source_documents:
    [150](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/retrieval_qa/base.py:150)     return {self.output_key: answer, "source_documents": docs}

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180, in deprecated.<locals>.deprecate.<locals>.warning_emitting_wrapper(*args, **kwargs)
    [178](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:178)     warned = True
    [179](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:179)     emit_warning()
--> [180](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180) return wrapped(*args, **kwargs)

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:605, in Chain.run(self, callbacks, tags, metadata, *args, **kwargs)
    [600](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:600)     return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[
    [601](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:601)         _output_key
    [602](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:602)     ]
    [604](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:604) if kwargs and not args:
--> [605](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:605)     return self(kwargs, callbacks=callbacks, tags=tags, metadata=metadata)[
    [606](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:606)         _output_key
    [607](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:607)     ]
    [609](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:609) if not kwargs and not args:
    [610](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:610)     raise ValueError(
    [611](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:611)         "`run` supported with either positional arguments or keyword arguments,"
    [612](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:612)         " but none were provided."
    [613](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:613)     )

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180, in deprecated.<locals>.deprecate.<locals>.warning_emitting_wrapper(*args, **kwargs)
    [178](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:178)     warned = True
    [179](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:179)     emit_warning()
--> [180](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180) return wrapped(*args, **kwargs)

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:383, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    [351](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:351) """Execute the chain.
    [352](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:352) 
    [353](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:353) Args:
   (...)
    [374](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:374)         `Chain.output_keys`.
    [375](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:375) """
    [376](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:376) config = {
    [377](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:377)     "callbacks": callbacks,
    [378](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:378)     "tags": tags,
    [379](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:379)     "metadata": metadata,
    [380](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:380)     "run_name": run_name,
    [381](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:381) }
--> [383](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:383) return self.invoke(
    [384](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:384)     inputs,
    [385](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:385)     cast(RunnableConfig, {k: v for k, v in config.items() if v is not None}),
    [386](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:386)     return_only_outputs=return_only_outputs,
    [387](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:387)     include_run_info=include_run_info,
    [388](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:388) )

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166, in Chain.invoke(self, input, config, **kwargs)
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:
    [165](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:165)     run_manager.on_chain_error(e)
--> [166](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166)     raise e
    [167](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:167) run_manager.on_chain_end(outputs)
    [169](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:169) if include_run_info:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156, in Chain.invoke(self, input, config, **kwargs)
    [153](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:153) try:
    [154](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:154)     self._validate_inputs(inputs)
    [155](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:155)     outputs = (
--> [156](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156)         self._call(inputs, run_manager=run_manager)
    [157](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:157)         if new_arg_supported
    [158](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:158)         else self._call(inputs)
    [159](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:159)     )
    [161](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:161)     final_outputs: Dict[str, Any] = self.prep_outputs(
    [162](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:162)         inputs, outputs, return_only_outputs
    [163](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:163)     )
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:137, in BaseCombineDocumentsChain._call(self, inputs, run_manager)
    [135](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:135) # Other keys are assumed to be needed for LLM prediction
    [136](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:136) other_keys = {k: v for k, v in inputs.items() if k != self.input_key}
--> [137](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:137) output, extra_return_dict = self.combine_docs(
    [138](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:138)     docs, callbacks=_run_manager.get_child(), **other_keys
    [139](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:139) )
    [140](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:140) extra_return_dict[self.output_key] = output
    [141](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/base.py:141) return extra_return_dict

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/stuff.py:244, in StuffDocumentsChain.combine_docs(self, docs, callbacks, **kwargs)
    [242](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/stuff.py:242) inputs = self._get_inputs(docs, **kwargs)
    [243](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/stuff.py:243) # Call predict on the LLM.
--> [244](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/combine_documents/stuff.py:244) return self.llm_chain.predict(callbacks=callbacks, **inputs), {}

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:316, in LLMChain.predict(self, callbacks, **kwargs)
    [301](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:301) def predict(self, callbacks: Callbacks = None, **kwargs: Any) -> str:
    [302](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:302)     """Format prompt with kwargs and pass to LLM.
    [303](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:303) 
    [304](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:304)     Args:
   (...)
    [314](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:314)             completion = llm.predict(adjective="funny")
    [315](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:315)     """
--> [316](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:316)     return self(kwargs, callbacks=callbacks)[self.output_key]

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180, in deprecated.<locals>.deprecate.<locals>.warning_emitting_wrapper(*args, **kwargs)
    [178](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:178)     warned = True
    [179](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:179)     emit_warning()
--> [180](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:180) return wrapped(*args, **kwargs)

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:383, in Chain.__call__(self, inputs, return_only_outputs, callbacks, tags, metadata, run_name, include_run_info)
    [351](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:351) """Execute the chain.
    [352](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:352) 
    [353](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:353) Args:
   (...)
    [374](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:374)         `Chain.output_keys`.
    [375](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:375) """
    [376](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:376) config = {
    [377](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:377)     "callbacks": callbacks,
    [378](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:378)     "tags": tags,
    [379](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:379)     "metadata": metadata,
    [380](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:380)     "run_name": run_name,
    [381](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:381) }
--> [383](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:383) return self.invoke(
    [384](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:384)     inputs,
    [385](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:385)     cast(RunnableConfig, {k: v for k, v in config.items() if v is not None}),
    [386](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:386)     return_only_outputs=return_only_outputs,
    [387](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:387)     include_run_info=include_run_info,
    [388](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:388) )

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166, in Chain.invoke(self, input, config, **kwargs)
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:
    [165](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:165)     run_manager.on_chain_error(e)
--> [166](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:166)     raise e
    [167](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:167) run_manager.on_chain_end(outputs)
    [169](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:169) if include_run_info:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156, in Chain.invoke(self, input, config, **kwargs)
    [153](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:153) try:
    [154](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:154)     self._validate_inputs(inputs)
    [155](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:155)     outputs = (
--> [156](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:156)         self._call(inputs, run_manager=run_manager)
    [157](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:157)         if new_arg_supported
    [158](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:158)         else self._call(inputs)
    [159](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:159)     )
    [161](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:161)     final_outputs: Dict[str, Any] = self.prep_outputs(
    [162](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:162)         inputs, outputs, return_only_outputs
    [163](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:163)     )
    [164](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/base.py:164) except BaseException as e:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:126, in LLMChain._call(self, inputs, run_manager)
    [121](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:121) def _call(
    [122](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:122)     self,
    [123](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:123)     inputs: Dict[str, Any],
    [124](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:124)     run_manager: Optional[CallbackManagerForChainRun] = None,
    [125](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:125) ) -> Dict[str, str]:
--> [126](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:126)     response = self.generate([inputs], run_manager=run_manager)
    [127](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:127)     return self.create_outputs(response)[0]

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:138, in LLMChain.generate(self, input_list, run_manager)
    [136](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:136) callbacks = run_manager.get_child() if run_manager else None
    [137](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:137) if isinstance(self.llm, BaseLanguageModel):
--> [138](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:138)     return self.llm.generate_prompt(
    [139](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:139)         prompts,
    [140](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:140)         stop,
    [141](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:141)         callbacks=callbacks,
    [142](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:142)         **self.llm_kwargs,
    [143](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:143)     )
    [144](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:144) else:
    [145](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:145)     results = self.llm.bind(stop=stop, **self.llm_kwargs).batch(
    [146](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:146)         cast(List, prompts), {"callbacks": callbacks}
    [147](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain/chains/llm.py:147)     )

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:777, in BaseChatModel.generate_prompt(self, prompts, stop, callbacks, **kwargs)
    [769](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:769) def generate_prompt(
    [770](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:770)     self,
    [771](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:771)     prompts: List[PromptValue],
   (...)
    [774](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:774)     **kwargs: Any,
    [775](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:775) ) -> LLMResult:
    [776](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:776)     prompt_messages = [p.to_messages() for p in prompts]
--> [777](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:777)     return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:634, in BaseChatModel.generate(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)
    [632](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:632)         if run_managers:
    [633](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:633)             run_managers[i].on_llm_error(e, response=LLMResult(generations=[]))
--> [634](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:634)         raise e
    [635](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:635) flattened_outputs = [
    [636](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:636)     LLMResult(generations=[res.generations], llm_output=res.llm_output)  # type: ignore[list-item]
    [637](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:637)     for res in results
    [638](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:638) ]
    [639](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:639) llm_output = self._combine_llm_outputs([res.llm_output for res in results])

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:624, in BaseChatModel.generate(self, messages, stop, callbacks, tags, metadata, run_name, run_id, **kwargs)
    [621](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:621) for i, m in enumerate(messages):
    [622](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:622)     try:
    [623](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:623)         results.append(
--> [624](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:624)             self._generate_with_cache(
    [625](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:625)                 m,
    [626](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:626)                 stop=stop,
    [627](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:627)                 run_manager=run_managers[i] if run_managers else None,
    [628](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:628)                 **kwargs,
    [629](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:629)             )
    [630](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:630)         )
    [631](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:631)     except BaseException as e:
    [632](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:632)         if run_managers:

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:846, in BaseChatModel._generate_with_cache(self, messages, stop, run_manager, **kwargs)
    [844](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:844) else:
    [845](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:845)     if inspect.signature(self._generate).parameters.get("run_manager"):
--> [846](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:846)         result = self._generate(
    [847](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:847)             messages, stop=stop, run_manager=run_manager, **kwargs
    [848](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:848)         )
    [849](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:849)     else:
    [850](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py:850)         result = self._generate(messages, stop=stop, **kwargs)

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:523, in ChatBedrock._generate(self, messages, stop, run_manager, **kwargs)
    [521](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:521)             system = self.system_prompt_with_tools
    [522](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:522) else:
--> [523](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:523)     prompt = ChatPromptAdapter.convert_messages_to_prompt(
    [524](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:524)         provider=provider, messages=messages, model=self._get_model()
    [525](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:525)     )
    [527](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:527) if stop:
    [528](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:528)     params["stop_sequences"] = stop

File ~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:359, in ChatPromptAdapter.convert_messages_to_prompt(cls, provider, messages, model)
    [353](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:353)     prompt = convert_messages_to_prompt_anthropic(
    [354](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:354)         messages=messages,
    [355](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:355)         human_prompt="\n\nUser:",
    [356](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:356)         ai_prompt="\n\nBot:",
    [357](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:357)     )
    [358](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:358) else:
--> [359](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:359)     raise NotImplementedError(
    [360](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:360)         f"Provider {provider} model does not support chat."
    [361](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:361)     )
    [362](https://file+.vscode-resource.vscode-cdn.net/Users/anirudh.shrinivason/Downloads/~/miniconda3/envs/pal_test/lib/python3.11/site-packages/langchain_aws/chat_models/bedrock.py:362) return prompt

NotImplementedError: Provider cohere model does not support chat.

Description

I would like to use the cohere models on bedrock. I am able to run the below code properly:

import boto3

session = boto3.client(
    service_name='bedrock-runtime',
    aws_access_key_id='',
    aws_secret_access_key='',
    region_name='us-east-1' 
)

from langchain_aws import ChatBedrock
params = {
    "client":session,
    "region_name": "us-east-1",
    "model_id": "cohere.command-r-plus-v1:0",
    "beta_use_converse_api": True
}
model = ChatBedrock(**params)
response = model.invoke("What is Cohere!")

So, I am not sure why I am receiving "Cohere model not supported for chat" error, when chat is supported for cohere models on bedrock.

System Info

aiohappyeyeballs==2.3.4
aiohttp==3.10.0
aiosignal==1.3.1
annotated-types==0.7.0
anyio==4.4.0
appnope==0.1.4
asttokens==2.4.1
attrs==24.1.0
beautifulsoup4==4.12.3
black==24.8.0
boto3==1.34.149
botocore==1.34.149
cachetools==5.5.0
certifi==2024.7.4
cfgv==3.4.0
charset-normalizer==3.3.2
click==8.1.7
cohere==5.11.3
comm==0.2.2
dataclasses-json==0.6.7
debugpy==1.8.5
decorator==5.1.1
Deprecated==1.2.14
dirtyjson==1.0.8
distlib==0.3.8
distro==1.9.0
executing==2.1.0
fastavro==1.9.5
filelock==3.15.4
frozenlist==1.4.1
fsspec==2024.6.1
google-api-core==2.23.0
google-api-python-client==2.153.0
google-auth==2.36.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.1
google-cloud-storage==2.18.2
google-crc32c==1.6.0
google-resumable-media==2.7.2
googleapis-common-protos==1.66.0
greenlet==3.0.3
h11==0.14.0
httpcore==1.0.5
httplib2==0.22.0
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.24.2
identify==2.6.0
idna==3.7
iniconfig==2.0.0
ipykernel==6.29.5
ipython==8.27.0
ipywidgets==8.1.5
jedi==0.19.1
jmespath==1.0.1
joblib==1.4.2
jsonpatch==1.33
jsonpointer==3.0.0
jupyter_client==8.6.2
jupyter_core==5.7.2
jupyterlab_widgets==3.0.13
langchain==0.2.15
langchain-aws==0.1.17
langchain-cohere==0.2.3
langchain-community==0.2.15
langchain-core==0.2.37
langchain-experimental==0.0.64
langchain-text-splitters==0.2.2
langsmith==0.1.110
markdown-it-py==3.0.0
markdown_pdf==1.3
marshmallow==3.21.3
matplotlib-inline==0.1.7
mdurl==0.1.2
multidict==6.0.5
mypy-extensions==1.0.0
nest-asyncio==1.6.0
networkx==3.3
nltk==3.8.1
nodeenv==1.9.1
numpy==1.26.4
openai==1.38.0
orjson==3.10.7
packaging==24.1
pandas==2.2.2
parameterized==0.9.0
parso==0.8.4
pathspec==0.12.1
pexpect==4.9.0
pillow==10.4.0
platformdirs==4.2.2
pluggy==1.5.0
pre-commit==3.8.0
prompt_toolkit==3.0.47
proto-plus==1.25.0
protobuf==5.28.3
psutil==6.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyasn1==0.6.1
pyasn1_modules==0.4.1
pydantic==2.8.2
pydantic_core==2.20.1
Pygments==2.18.0
PyMuPDF==1.24.2
PyMuPDFb==1.24.1
pyparsing==3.2.0
pypdf==5.1.0
pytest==8.2.2
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.1
PyYAML==6.0.1
pyzmq==26.2.0
regex==2024.7.24
requests==2.32.3
rsa==4.9
s3transfer==0.10.2
six==1.16.0
sniffio==1.3.1
soupsieve==2.6
SQLAlchemy==2.0.31
stack-data==0.6.3
tabulate==0.9.0
tenacity==8.5.0
tiktoken==0.7.0
tokenizers==0.19.1
tornado==6.4.1
tqdm==4.66.4
traitlets==5.14.3
types-requests==2.32.0.20240712
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
uritemplate==4.1.1
urllib3==2.2.2
virtualenv==20.26.3
wcwidth==0.2.13
widgetsnbextension==4.0.13
wikipedia==1.4.0
wrapt==1.16.0
yarl==1.9.4

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant