Skip to content

Refactor function calling to incorporate the tool declaration automatically into the underlying model processors. This avoids duplicating tool declaration in both models and function calling processor which could lead to errors and inconsistencies. This also makes function calling more robust with the ability to define function calling processor on top of other function calling processors, adding capabilities incrementally on other processors.#144

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
test_891591218

Conversation

@copybara-service
Copy link
Copy Markdown

Refactor function calling to incorporate the tool declaration automatically into the underlying model processors. This avoids duplicating tool declaration in both models and function calling processor which could lead to errors and inconsistencies. This also makes function calling more robust with the ability to define function calling processor on top of other function calling processors, adding capabilities incrementally on other processors.

To that end, we added an "add_tool" method to the model processors and to chain processors and function calling. The tools can then be registered after a model processor is created.

The new code is backward compatible: if the model has registered tools in its constructor, the function calling method will not duplicate the tools.

…ically into the underlying model processors. This avoids duplicating tool declaration in both models and function calling processor which could lead to errors and inconsistencies. This also makes function calling more robust with the ability to define function calling processor on top of other function calling processors, adding capabilities incrementally on other processors.

To that end, we added an "add_tool" method to the model processors and to chain processors and function calling. The tools can then be registered after a model processor is created.

The new code is backward compatible: if the model has registered tools in its constructor, the function calling method will not duplicate the tools.

PiperOrigin-RevId: 891591218
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.

1 participant