Skip to content
Rasmus Wulff Jensen edited this page Jan 27, 2026 · 4 revisions

NuGet README

Features

  • AgentFactory (GoogleAgentFactory)
  • AIToolsFactory integration (tools in GoogleAgentOptions.Tools)
  • EmbeddingFactory (GoogleEmbeddingFactory)
  • Thinking controls via ThinkingBudget (Gemini < 3) or ThinkingLevel + IncludeThoughts (Gemini 3+)

Package

dotnet add package AgentFrameworkToolkit.Google

Quick start

GoogleAgentFactory agentFactory = new("<apiKey>");
GoogleAgent agent = agentFactory.CreateAgent(new GoogleAgentOptions
{
    Model = "gemini-2.5-flash",
    ThinkingBudget = 5000,
    Instructions = "You are a nice AI"
});

AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);

Embeddings

GoogleEmbeddingFactory embeddingFactory = new("<apiKey>");
IEmbeddingGenerator<string, Embedding<float>> generator =
    embeddingFactory.GetEmbeddingGenerator("gemini-embedding-001", dimensions: 3072);
Embedding<float> embedding = await generator.GenerateAsync("Hello");

Connection options

  • ApiKey (Gemini API key, optional depending on usage)
  • VertexAI (optional, use Vertex AI APIs)
  • Credential (Vertex-only, optional)
  • Project (Vertex-only, optional)
  • Location (Vertex-only, optional)
  • NetworkTimeout (optional)
  • HttpOptions (optional)

Dependency injection

builder.Services.AddGoogleAgentFactory("<apiKey>");
builder.Services.AddGoogleAgentFactory(new GoogleConnection
{
    ApiKey = "<apiKey>"
});

builder.Services.AddGoogleEmbeddingFactory("<apiKey>");

Notes

Clone this wiki locally