Skip to content
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

feat: Add support for tool calling in ChatGoogleGenerativeAI #419

Merged
merged 1 commit into from
May 13, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented May 13, 2024

Resolves #408

const tool = ToolSpec(
  name: 'get_current_weather',
  description: 'Get the current weather in a given location',
  inputJsonSchema: {
    'type': 'object',
    'properties': {
      'location': {
        'type': 'string',
        'description': 'The city and state, e.g. San Francisco, CA',
      },
    },
    'required': ['location'],
  },
);
final chatModel = ChatGoogleGenerativeAI(
  defaultOptions: ChatGoogleGenerativeAIOptions(
    model: 'gemini-1.5-pro-latest',
    temperature: 0,
    tools: [tool],
  ),
);
final res = await model.invoke(
  PromptValue.string('What’s the weather like in Boston and Madrid right now in celsius?'),
);

Check the docs for more information on how to use tools.

@davidmigloz davidmigloz self-assigned this May 13, 2024
@davidmigloz davidmigloz added c:tools Tools. p:langchain_google langchain_google package. t:enhancement New feature or request labels May 13, 2024
@davidmigloz davidmigloz added this to the v0.8.0 milestone May 13, 2024
@davidmigloz davidmigloz merged commit df41f38 into main May 13, 2024
1 check passed
@davidmigloz davidmigloz deleted the gemini-tools branch May 13, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:tools Tools. p:langchain_google langchain_google package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add support for tool calling in ChatGoogleGenerativeAI
1 participant