langchain-ai / langchain-google

MIT License
117 stars 147 forks source link

vertexai: add finish message when available to the response object from gemini … #595

Closed nanodan closed 1 week ago

nanodan commented 1 week ago

PR Description

Currently the response from gemini is parsed into a dict which is passed as the generation_info to a ChatGeneration object. However, this is missing a key piece of information useful for debugging when function calls fail when using function calling via the bind_tools syntax which is the finish_message. The finish message is populated with information about the malformed function call in the case of MALFORMED_FUNCTION_CALL errors. This PR simply adds this field when available to the dictionary passed back.

Relevant issues

None

Type

🆕 New Feature

Changes(optional)

Added in finish_message field to the generation_info in the case of a gemini model invocation.

nanodan commented 1 week ago

I can't see the results of the build to see why this is failing, all my local tests complete successfully, and this is a very minor change.