aws-samples / amazon-bedrock-workshop

This is a workshop designed for Amazon Bedrock a foundational model service.
https://catalog.us-east-1.prod.workshops.aws/workshops/a4bdb007-5600-4368-81c5-ff5b4154f518/en-US/20-intro
MIT No Attribution
1.25k stars 540 forks source link

Amazon Bedrock Workshop - [Bug] #256

Open codekiln opened 1 month ago

codekiln commented 1 month ago

Describe the bug In the code cell below ### Invoke Langchain with Chain using BedrockChat class in 06_OpenSource_examples/05_OpenSource_agents/01_tools_agents.ipynb, there's a deprecation warning:

/Users/pnore/Library/Caches/pypoetry/virtualenvs/genai-langserve-IOUqE2kZ-py3.11/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:119: LangChainDeprecationWarning: The class `BedrockChat` was deprecated in LangChain 0.0.34 and will be removed in 0.3. An updated version of the class exists in the langchain-aws package and should be used instead. To use it run `pip install -U langchain-aws` and import as `from langchain_aws import ChatBedrock`.

Also, in the code cell that contains llm_math_chain({'question': 'text 4**5'}) there's another more pressing deprecation:

LangChainDeprecationWarning: The method `Chain.__call__` was deprecated in langchain 0.1.0 and will be removed in 0.2.0. Use invoke instead.
  warn_deprecated(

In the cell ask_agent("can you check the weather in Marysville WA for me?", react_agent_llm) there's another langchain 0.2.0 deprecation warning:

LangChainDeprecationWarning: The function `initialize_agent` was deprecated in LangChain 0.1.0 and will be removed in 0.2.0. Use Use new agent constructor methods like create_react_agent, create_json_agent, create_structured_chat_agent, etc. instead.
  warn_deprecated(

Note: the code continues to function for now.

Other places in this notebook (correctly, for now) use from langchain_aws.chat_models.bedrock import ChatBedrock.

To Reproduce Steps to reproduce the behavior (or some version of this):

  1. Go to 06_OpenSource_examples/05_OpenSource_agents/01_tools_agents.ipynb
  2. Run all cells above ### Invoke Langchain with \Chain` using BedrockChat class`
  3. Run the code cell immediately before
  4. See warning

Expected behavior Latest, non-deprecated version of langchain-aws's bedrock adapter used

Screenshots image

Desktop (please complete the following information):

w601sxs commented 1 month ago

Can you take a look @rsgrewal-aws ?

rsgrewal-aws commented 1 month ago

Yes ack – will do so

From: Shreyas Subramanian @.> Reply-To: aws-samples/amazon-bedrock-workshop @.> Date: Wednesday, May 29, 2024 at 8:05 AM To: aws-samples/amazon-bedrock-workshop @.> Cc: "Grewal, Rupinder" @.>, Mention @.***> Subject: Re: [aws-samples/amazon-bedrock-workshop] Amazon Bedrock Workshop - [Bug] (Issue #256)

Can you take a look @rsgrewal-awshttps://github.com/rsgrewal-aws ?

— Reply to this email directly, view it on GitHubhttps://github.com/aws-samples/amazon-bedrock-workshop/issues/256#issuecomment-2137641563, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYMBZRURI3Y57Y7PTIUHMBLZEXVAZAVCNFSM6AAAAABIAIRBXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGY2DCNJWGM. You are receiving this because you were mentioned.Message ID: @.***>