geminiCLI

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 request translation functionality for Claude API. It handles parsing and transforming Claude API requests into the internal client format, extracting model information, system instructions, message contents, and tool declarations. The package also performs JSON data cleaning and transformation to ensure compatibility between Claude API format and the internal client's expected format.

Package gemini_cli provides response translation functionality for Gemini API to Gemini CLI API. This package handles the conversion of Gemini API responses into Gemini CLI-compatible JSON format, transforming streaming events and non-streaming responses into the format expected by Gemini CLI API clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGeminiCLIRequestToGemini

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

PrepareClaudeRequest parses and transforms a Claude API request into internal client format. It extracts the model name, system instruction, message contents, and tool declarations from the raw JSON request and returns them in the format expected by the internal client.

func ConvertGeminiResponseToGeminiCLI

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

ConvertGeminiResponseToGeminiCLI converts Gemini streaming response format to Gemini CLI single-line JSON format. This function processes various Gemini event types and transforms them into Gemini CLI-compatible JSON responses. It handles thinking content, regular text content, and function calls, outputting single-line JSON that matches the Gemini CLI API response format.

Parameters:

  • ctx: The context for the request.
  • modelName: The name of the model.
  • rawJSON: The raw JSON response from the Gemini API.
  • param: A pointer to a parameter object for the conversion (unused).

Returns:

  • []string: A slice of strings, each containing a Gemini CLI-compatible JSON response.

func ConvertGeminiResponseToGeminiCLINonStream

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

ConvertGeminiResponseToGeminiCLINonStream converts a non-streaming Gemini response to a non-streaming Gemini CLI response.

Parameters:

  • ctx: The context for the request.
  • modelName: The name of the model.
  • rawJSON: The raw JSON response from the Gemini API.
  • param: A pointer to a parameter object for the conversion (unused).

Returns:

  • string: A Gemini CLI-compatible JSON response.

func GeminiCLITokenCount

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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