 Documentation
      ¶
      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 ¶
- func ConvertGeminiCLIRequestToGemini(_ string, inputRawJSON []byte, _ bool) []byte
- func ConvertGeminiResponseToGeminiCLI(_ context.Context, _ string, ...) []string
- func ConvertGeminiResponseToGeminiCLINonStream(_ context.Context, _ string, ...) string
- func GeminiCLITokenCount(ctx context.Context, count int64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertGeminiCLIRequestToGemini ¶
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.
Types ¶
This section is empty.