executor

package
v6.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package executor provides runtime execution capabilities for various AI service providers. It includes stateless executors that handle API requests, streaming responses, token counting, and authentication refresh for different AI service providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeExecutor

type ClaudeExecutor struct {
	// contains filtered or unexported fields
}

ClaudeExecutor is a stateless executor for Anthropic Claude over the messages API. If api_key is unavailable on auth, it falls back to legacy via ClientAdapter.

func NewClaudeExecutor

func NewClaudeExecutor(cfg *config.Config) *ClaudeExecutor

func (*ClaudeExecutor) ExecuteStream

func (*ClaudeExecutor) Identifier

func (e *ClaudeExecutor) Identifier() string

func (*ClaudeExecutor) PrepareRequest

func (e *ClaudeExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

func (*ClaudeExecutor) Refresh

type CodexExecutor

type CodexExecutor struct {
	// contains filtered or unexported fields
}

CodexExecutor is a stateless executor for Codex (OpenAI Responses API entrypoint). If api_key is unavailable on auth, it falls back to legacy via ClientAdapter.

func NewCodexExecutor

func NewCodexExecutor(cfg *config.Config) *CodexExecutor

func (*CodexExecutor) ExecuteStream

func (*CodexExecutor) Identifier

func (e *CodexExecutor) Identifier() string

func (*CodexExecutor) PrepareRequest

func (e *CodexExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

func (*CodexExecutor) Refresh

func (e *CodexExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (*cliproxyauth.Auth, error)

type GeminiCLIExecutor

type GeminiCLIExecutor struct {
	// contains filtered or unexported fields
}

GeminiCLIExecutor talks to the Cloud Code Assist endpoint using OAuth credentials from auth metadata.

func NewGeminiCLIExecutor

func NewGeminiCLIExecutor(cfg *config.Config) *GeminiCLIExecutor

func (*GeminiCLIExecutor) ExecuteStream

func (*GeminiCLIExecutor) Identifier

func (e *GeminiCLIExecutor) Identifier() string

func (*GeminiCLIExecutor) PrepareRequest

func (e *GeminiCLIExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

func (*GeminiCLIExecutor) Refresh

type GeminiExecutor

type GeminiExecutor struct {
	// contains filtered or unexported fields
}

GeminiExecutor is a stateless executor for the official Gemini API using API keys. It handles both API key and OAuth bearer token authentication, supporting both regular and streaming requests to the Google Generative Language API.

func NewGeminiExecutor

func NewGeminiExecutor(cfg *config.Config) *GeminiExecutor

NewGeminiExecutor creates a new Gemini executor instance.

Parameters:

  • cfg: The application configuration

Returns:

  • *GeminiExecutor: A new Gemini executor instance

func (*GeminiExecutor) Execute

Execute performs a non-streaming request to the Gemini API. It translates the request to Gemini format, sends it to the API, and translates the response back to the requested format.

Parameters:

  • ctx: The context for the request
  • auth: The authentication information
  • req: The request to execute
  • opts: Additional execution options

Returns:

  • cliproxyexecutor.Response: The response from the API
  • error: An error if the request fails

func (*GeminiExecutor) ExecuteStream

func (*GeminiExecutor) Identifier

func (e *GeminiExecutor) Identifier() string

Identifier returns the executor identifier for Gemini.

func (*GeminiExecutor) PrepareRequest

func (e *GeminiExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

PrepareRequest prepares the HTTP request for execution (no-op for Gemini).

func (*GeminiExecutor) Refresh

type GeminiWebExecutor

type GeminiWebExecutor struct {
	// contains filtered or unexported fields
}

func NewGeminiWebExecutor

func NewGeminiWebExecutor(cfg *config.Config) *GeminiWebExecutor

func (*GeminiWebExecutor) ExecuteStream

func (*GeminiWebExecutor) Identifier

func (e *GeminiWebExecutor) Identifier() string

func (*GeminiWebExecutor) PrepareRequest

func (e *GeminiWebExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

func (*GeminiWebExecutor) Refresh

type OpenAICompatExecutor

type OpenAICompatExecutor struct {
	// contains filtered or unexported fields
}

OpenAICompatExecutor implements a stateless executor for OpenAI-compatible providers. It performs request/response translation and executes against the provider base URL using per-auth credentials (API key) and per-auth HTTP transport (proxy) from context.

func NewOpenAICompatExecutor

func NewOpenAICompatExecutor(provider string, cfg *config.Config) *OpenAICompatExecutor

NewOpenAICompatExecutor creates an executor bound to a provider key (e.g., "openrouter").

func (*OpenAICompatExecutor) CountTokens

func (*OpenAICompatExecutor) ExecuteStream

func (*OpenAICompatExecutor) Identifier

func (e *OpenAICompatExecutor) Identifier() string

Identifier implements cliproxyauth.ProviderExecutor.

func (*OpenAICompatExecutor) PrepareRequest

func (e *OpenAICompatExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

PrepareRequest is a no-op for now (credentials are added via headers at execution time).

func (*OpenAICompatExecutor) Refresh

Refresh is a no-op for API-key based compatibility providers.

type QwenExecutor

type QwenExecutor struct {
	// contains filtered or unexported fields
}

QwenExecutor is a stateless executor for Qwen Code using OpenAI-compatible chat completions. If access token is unavailable, it falls back to legacy via ClientAdapter.

func NewQwenExecutor

func NewQwenExecutor(cfg *config.Config) *QwenExecutor

func (*QwenExecutor) ExecuteStream

func (*QwenExecutor) Identifier

func (e *QwenExecutor) Identifier() string

func (*QwenExecutor) PrepareRequest

func (e *QwenExecutor) PrepareRequest(_ *http.Request, _ *cliproxyauth.Auth) error

func (*QwenExecutor) Refresh

func (e *QwenExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (*cliproxyauth.Auth, error)

Jump to

Keyboard shortcuts

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