langchain/docs/extras
Alejandra De Luna 2e4047e5e7
feat: support generate as an early stopping method for OpenAIFunctionsAgent (#7229)
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"`.

  - Relevant maintainer: @hinthornw
  - Twitter handle: @aledelunap

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-07-11 09:25:02 -04:00
..
_templates Doc refactor (#6300) 2023-06-16 11:52:56 -07:00
additional_resources docs: update youtube videos and tutorials (#6515) 2023-07-05 12:50:31 -07:00
ecosystem Datadog logs loader (#7356) 2023-07-10 04:27:55 -04:00
guides added template repo for CI/CD deployment on Google Cloud Run (#7218) 2023-07-06 09:38:38 -04:00
modules feat: support generate as an early stopping method for OpenAIFunctionsAgent (#7229) 2023-07-11 09:25:02 -04:00
use_cases Minor edits to QA docs (#7507) 2023-07-10 22:15:05 -07:00