Skip to content

Unable to use gemma model #418

@sahilrajput03

Description

@sahilrajput03

Unable to use gemma model:

import { FunctionTool, LlmAgent } from '@google/adk';
import { z } from 'zod';

/* Mock tool implementation */
const getCurrentTime = new FunctionTool({
    name: 'get_current_time',
    description: 'Returns the current time in a specified city.',
    parameters: z.object({
        city: z.string().describe("The name of the city for which to retrieve the current time."),
    }),
    execute: ({ city }) => {
        return { status: 'success', report: `The current time in ${city} is 10:30 AM` };
    },
});

export const rootAgent = new LlmAgent({
    name: 'hello_time_agent',
    model: 'gemma-4-31b-it',
    description: 'Tells the current time in a specified city.',
    instruction: `You are a helpful assistant that tells the current time in a city.
                Use the 'getCurrentTime' tool for this purpose.`,
    tools: [getCurrentTime],
});

Output:

 npx adk run agent.ts
[dotenv@17.3.1] injecting env (1) from .env -- tip: ⚙️  write to custom object with { processEnv: myObject }
(node:47611) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Running agent hello_time_agent, type exit to exit.
[user]: hi
[ADK INFO]: event:  {"invocationId":"e-b42c2088-d807-42ba-9d4e-64c8e81aa096","author":"user","actions":{"stateDelta":{},"artifactDelta":{},"requestedAuthConfigs":{},"requestedToolConfirmations":{}},"content":{"role":"user","parts":[{"text":"hi"}]},"id":"Ae63mZ14","longRunningToolIds":[],"timestamp":1780861449099}
Error: Model gemma-4-31b-it not found.
    at Od.resolve (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:256:6857)
    at Od.newLlm (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:256:6367)
    at get canonicalModel (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:323:2389)
    at trr.runAsync (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:256:16297)
    at runAsync.next (<anonymous>)
    at TA.runOneStepAsync (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:323:4802)
    at runOneStepAsync.next (<anonymous>)
    at TA.runAsyncImpl (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:323:4282)
    at runAsyncImpl.next (<anonymous>)
    at TA.<anonymous> (/private/var/folders/5k/slsrk9d90bg806p4zvyx829m0000gn/T/adk_agent_loader/1780861447507/agent.cjs:246:39665)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrequest clarification[Status] The maintainer need clarification or more information from the author

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions