@noetaris/harness-google
v0.5.1
Published
Google Gemini adapter for @noetaris/harness
Downloads
84
Readme
@noetaris/harness-google
Google Gemini adapter for @noetaris/harness.
Status: not yet released. Implementation tracked in F22.
Overview
@noetaris/harness-google provides a Gemini class that implements the LLM and ObserverAware interfaces from @noetaris/harness. It handles translation between the harness message format and the Google Generative AI SDK (generateContent) format, and emits telemetry events (token usage, model ID) through an attached Observer.
Installation
pnpm add @noetaris/harness-googlePeer dependencies:
pnpm add @noetaris/harness @noetaris/harness-typesRequires Node.js ≥ 22.
Usage
import { Gemini } from '@noetaris/harness-google'
const llm = new Gemini({ apiKey: process.env.GOOGLE_API_KEY })
// Wire into a harness provider slot
h.provide('model', runtime())
const agent = createAgent(h, { prompts: { system: '...' } })
const run = agent.run(initialState, { model: llm })API
Gemini
Implements LLM and ObserverAware.
invoke(messages, options?)— translates harnessMessage[]andTool[]to Google Generative AI SDK format, callsgenerateContent(), and maps the response back toLLMResponse(including function call extraction from candidates).bindObserver(observer)— attaches anObserver; after eachinvoke, emits an"llm.response"event with{ tokens: { input, output }, modelId }fromusageMetadatain the response.
MockGemini
A deterministic test double for use in tests and demos without a real API key.
Related Packages
@noetaris/harness— core execution engine@noetaris/harness-types— shared LLM type contract@noetaris/harness-anthropic— Anthropic Claude adapter@noetaris/harness-openai— OpenAI adapter@noetaris/harness-otel— OpenTelemetry observer bridge
License
MIT
