Skip to content

Conversation

@lyntcelec
Copy link
Contributor

can't pass system_message argument, the prompt always show default message "System: You are a helpful AI assistant."

system_message = SystemMessage(
    content="You are an AI that provides information to Human regarding documentation."
)
agent = initialize_agent(
    tools,
    llm=openai_llm_chat,
    agent=AgentType.OPENAI_FUNCTIONS,
    system_message=system_message,
    agent_kwargs={
        "system_message": system_message,
    },
    verbose=False,
)

Who can review?

Tag maintainers/contributors who might be interested:

@vercel
Copy link

vercel bot commented Jun 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ❌ Failed (Inspect) Jun 16, 2023 4:06pm

@vercel vercel bot temporarily deployed to Preview June 16, 2023 16:06 Inactive
@lyntcelec
Copy link
Contributor Author

can you help me review it @hwchase17

Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@hwchase17 hwchase17 added the lgtm label Jun 19, 2023
@hwchase17 hwchase17 merged commit 1e0af59 into langchain-ai:master Jun 19, 2023
This was referenced Jun 25, 2023
@leiyeah
Copy link

leiyeah commented Nov 20, 2023

Still can not pass a system message to model. here is my code:

llm = AzureChatOpenAI(
     deployment_name=OPENAI_DEPLOYMENT_NAME,
     model_name="gpt-3.5",
     temperature=0.0,
    
 )
python_agent = create_csv_agent(
                            llm,
                            './device_data.csv',
                            verbose=True,
                            agent_executor_kwargs={"handle_parsing_errors": True},
                             agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
                      )

tools = [Tool(
                name="PythonREPL",
                func=python_agent.run,
                description="useful for when you need to run python code in a REPL to answer questions, for example for more complex calculations or other code executions necessary to be able to answer correctly. Input should be clear python code, nothing else. You should always use a final print() statement for the final result to be able to read the outputs."
                ),]

system_message = """you are a data analyst assistant
            
            [instructions for query answering]:
            In the Action Input section, always excute the Print function.
            In the Action Input section, don't convert the result to json format.
            
            If you find no data or Empty DataFrame, do not adjust the query,don't do any other thing that the query is not asking, 
            and reply 'There is no related data to answer your query'
            """

agent = initialize_agent(
          tools,
          llm,
          agent=AgentType.OPENAI_FUNCTIONS,
          system_message=system_message,
          agent_kwargs={
             "system_message": system_message
            },
      )

It is not working.
what should I modify to make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants