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

Bedrock Mistral not working as agent #19647

Open
5 tasks done
WaterKnight1998 opened this issue Mar 27, 2024 · 2 comments
Open
5 tasks done

Bedrock Mistral not working as agent #19647

WaterKnight1998 opened this issue Mar 27, 2024 · 2 comments
Labels
Ɑ: agent Related to agents module 🔌: aws Primarily related to Amazon Web Services (AWS) integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@WaterKnight1998
Copy link

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

from langchain import hub
from langchain_community.chat_models.bedrock import BedrockChat
from langchain.agents import AgentExecutor, create_structured_chat_agent

from langchain_community.tools.tavily_search import TavilySearchResults

prompt = hub.pull("hwchase17/structured-chat-agent")

llm_model = BedrockChat(
        region_name="us-east-1",
        model_id="mistral.mistral-7b-instruct-v0:2",
    )

tools = [TavilySearchResults()]
agent = create_structured_chat_agent(llm_model, tools, prompt)

agent_executor = AgentExecutor(
    agent=agent,
    tools=tools,
    verbose=True,
    handle_parsing_errors=True,
    return_intermediate_steps=True,
)

agent.invoke({"input": "What is the president of USA?"})

Error Message and Stack Trace (if applicable)

Exception: ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModelWithResponseStream operation: Malformed input request: #: extraneous key [stop_sequences] is not permitted, please reformat your input and try again.

Description

  • I am using Mistral model of AWS Bedrock as an agent
  • It doesn't work

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020
Python Version: 3.10.0 (default, Nov 11 2023, 18:46:15) [Clang 15.0.0 (clang-1500.0.40.1)]

Package Information

langchain_core: 0.1.34
langchain: 0.1.13
langchain_community: 0.0.29
langsmith: 0.1.33
langchain_google_vertexai: 0.1.2
langchain_openai: 0.0.8
langchain_text_splitters: 0.0.1
langchainhub: 0.1.15

Packages not installed (Not Necessarily a Problem)

The following packages were not found:

langgraph
langserve

@dosubot dosubot bot added Ɑ: agent Related to agents module 🔌: aws Primarily related to Amazon Web Services (AWS) integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Mar 27, 2024
@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Jun 26, 2024
@BasemRizk
Copy link

Hello , I have the same issue , do you find a solution ?

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Jul 2, 2024
@hasansustcse13
Copy link
Contributor

You can try this
agent = create_structured_chat_agent(llm_model, tools, prompt, stop_sequence=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: agent Related to agents module 🔌: aws Primarily related to Amazon Web Services (AWS) integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants