-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for tools on VertexAI #14839
Conversation
lkuligin
commented
Dec 18, 2023
- Description: added support for tools on VertexAI
- Twitter handle: lkuligin
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
02ab265
to
45f2fd5
Compare
def format_tool_to_vertex_function(tool: Tool) -> FunctionDescription: | ||
"Format tool into the Vertex function API." | ||
if tool.args_schema: | ||
return convert_pydantic_to_openai_function( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried this out and it errors, i think you need to remove title
from the json schema that is generated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hwchase17 which error do you get?
I've just tried this again
raw_tools = [
Tool(
name="Search",
func=search.run,
description="useful for when you need to answer questions about current events. You should ask targeted questions",
),
Tool(
name="Calculator",
func=llm_math_chain.run,
description="useful for when you need to answer questions about math",
)
]
tools = [format_tool_to_vertex_tool(tool) for tool in raw_tools]
and it seems to be working fine.
and there's also a working integration test:
def test_tools() -> None: |
@@ -14,7 +15,48 @@ | |||
from langchain.agents.agent import AgentOutputParser | |||
|
|||
|
|||
class OpenAIFunctionsAgentOutputParser(AgentOutputParser): | |||
class BaseFunctionsAgentOutputParser(AgentOutputParser): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like creating a BaseFunctionsAgentOutputParser
that both of these fit into, but I think this class and the VertexAIFunctionsAgentOutputParser
should be in a separate file outside of the OpenAI parser
Adding to vertex partner package in #15822 |