gemini

package
v6.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gemini provides in-provider request normalization for Gemini API. It ensures incoming v1beta requests meet minimal schema requirements expected by Google's Generative Language API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGeminiRequestToGemini

func ConvertGeminiRequestToGemini(_ string, inputRawJSON []byte, _ bool) []byte

ConvertGeminiRequestToGemini normalizes Gemini v1beta requests.

  • Adds a default role for each content if missing or invalid. The first message defaults to "user", then alternates user/model when needed.

It keeps the payload otherwise unchanged.

func GeminiTokenCount

func GeminiTokenCount(ctx context.Context, count int64) string

func PassthroughGeminiResponseNonStream

func PassthroughGeminiResponseNonStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, _ *any) string

PassthroughGeminiResponseNonStream forwards Gemini responses unchanged.

func PassthroughGeminiResponseStream

func PassthroughGeminiResponseStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, _ *any) []string

PassthroughGeminiResponseStream forwards Gemini responses unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL