aws-samples / amazon-kendra-langchain-extensions

Samples to build Generative AI applications with LangChain and Amazon Kendra
https://aws.amazon.com/blogs/machine-learning/quickly-build-high-accuracy-generative-ai-applications-on-enterprise-data-using-amazon-kendra-langchain-and-large-language-models/
MIT No Attribution
159 stars 103 forks source link

Errors after upgrading LangChain version #45

Closed jacobtaunton closed 1 year ago

jacobtaunton commented 1 year ago

When upgrading from LangChain 0.0.279 to 0.0.306 I am now seeing different errors being raised:

With 0.0.279:

ValueError: Error raised by bedrock service: 'Bedrock' object has no attribute 'invoke_model'

With 0.0.306:

ValueError: Error: Prompt must alternate between 'Human:' and 'Assistant:'.

It seems like the recent LangChain versions are causing these new issues that need to be resolved.

Reproduction steps:

  1. Install LangChain 0.0.279
  2. Run code using LangChain
  3. Upgrade to LangChain 0.0.306
  4. See new errors raised

Others are also reporting this in #11220. Would appreciate if the dev team could take a look and identify a fix. Let me know if any other info is needed!

jimburtoft commented 1 year ago

@jacobtaunton I ran into the same issue. You needed to update LangChain to get to talk to Bedrock, but now the history doesn't pass the "Bedrock Claude validation test". You can fix this by changing the order in the prompt history creation. See my pull request above.

jacobtaunton commented 1 year ago

@jacobtaunton I ran into the same issue. You needed to update LangChain to get to talk to Bedrock, but now the history doesn't pass the "Bedrock Claude validation test". You can fix this by changing the order in the prompt history creation. See my pull request above.

Confirmed your update fixed the issue, thanks for sharing!

jacobtaunton commented 1 year ago

I still get an error using the langchain version in the requirements.txt, but works correctly with 0.0.306 when using @jimburtoft update. langchain==0.0.279 line 196, in _call raise ValueError(f"Error raised by bedrock service: {e}") ValueError: Error raised by bedrock service: 'Bedrock' object has no attribute 'invoke_model'

MithilShah commented 1 year ago

Updated to the latest version of langchain and awscli. @jacobtaunton can you please try now. Thanks @jimburtoft for the fix!

jacobtaunton commented 1 year ago

Thanks @MithilShah & @jimburtoft issues is resolved.