Skip to content

Conversation

@aledelunap
Copy link
Contributor

This PR proposes an implementation to support generate as an early_stopping_method for the new OpenAIFunctionsAgent class.

The motivation behind is to facilitate the user to set a maximum number of actions the agent can take with max_iterations and force a final response with this new agent (as with the Agent class).

The following changes were made:

  • The OpenAIFunctionsAgent.return_stopped_response method was overwritten to support generate as an early_stopping_method
  • A boolean with_functions parameter was added to the OpenAIFunctionsAgent.plan method

This way the OpenAIFunctionsAgent.return_stopped_response method can call the OpenAIFunctionsAgent.plan method with with_function=False when the early_stopping_method is set to generate, making a call to the LLM with no functions and forcing a final response from the "assistant".

@vercel
Copy link

vercel bot commented Jul 5, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Jul 11, 2023 1:00pm

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.

this is great! can we add some documentation of this either on the class or in a notebook?

@aledelunap
Copy link
Contributor Author

@hwchase17 for sure, will request a review once added

@baskaryan baskaryan merged commit 2e4047e into langchain-ai:master Jul 11, 2023
@aledelunap aledelunap deleted the feat/functions-agent-generate branch July 11, 2023 15:54
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