oauthprovider

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClaudeTokenSource

func CreateClaudeTokenSource(getCredential func(string) (*auth.AuthCredential, error)) func() (string, error)

func CreateCodexTokenSource

func CreateCodexTokenSource() func() (string, string, error)

func FetchAntigravityProjectID

func FetchAntigravityProjectID(accessToken string) (string, error)

FetchAntigravityProjectID retrieves the Google Cloud project ID from the loadCodeAssist endpoint.

Types

type AntigravityModelInfo

type AntigravityModelInfo struct {
	ID          string `json:"id"`
	DisplayName string `json:"display_name"`
	IsExhausted bool   `json:"is_exhausted"`
}

func FetchAntigravityModels

func FetchAntigravityModels(accessToken, projectID string) ([]AntigravityModelInfo, error)

FetchAntigravityModels fetches available models from the Cloud Code Assist API.

type AntigravityProvider

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

AntigravityProvider implements LLMProvider using Google's Cloud Code Assist (Antigravity) API. This provider authenticates via Google OAuth and provides access to models like Claude and Gemini through Google's infrastructure.

func NewAntigravityProvider

func NewAntigravityProvider() *AntigravityProvider

NewAntigravityProvider creates a new Antigravity provider using stored auth credentials.

func (*AntigravityProvider) Chat

func (p *AntigravityProvider) Chat(
	ctx context.Context,
	messages []Message,
	tools []ToolDefinition,
	model string,
	options map[string]any,
) (*LLMResponse, error)

Chat implements LLMProvider.Chat using the Cloud Code Assist v1internal API. The v1internal endpoint wraps the standard Gemini request in an envelope with project, model, request, requestType, userAgent, and requestId fields.

func (*AntigravityProvider) GetDefaultModel

func (p *AntigravityProvider) GetDefaultModel() string

GetDefaultModel returns the default model identifier.

type CacheControl

type CacheControl = protocoltypes.CacheControl

type ClaudeProvider

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

func NewClaudeProvider

func NewClaudeProvider(token string) *ClaudeProvider

func NewClaudeProviderWithBaseURL

func NewClaudeProviderWithBaseURL(token, apiBase string) *ClaudeProvider

func NewClaudeProviderWithTokenSource

func NewClaudeProviderWithTokenSource(token string, tokenSource func() (string, error)) *ClaudeProvider

func NewClaudeProviderWithTokenSourceAndBaseURL

func NewClaudeProviderWithTokenSourceAndBaseURL(
	token string, tokenSource func() (string, error), apiBase string,
) *ClaudeProvider

func (*ClaudeProvider) Chat

func (p *ClaudeProvider) Chat(
	ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any,
) (*LLMResponse, error)

func (*ClaudeProvider) GetDefaultModel

func (p *ClaudeProvider) GetDefaultModel() string

type CodexProvider

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

func NewCodexProvider

func NewCodexProvider(token, accountID string) *CodexProvider

func NewCodexProviderWithTokenSource

func NewCodexProviderWithTokenSource(
	token, accountID string, tokenSource func() (string, string, error),
) *CodexProvider

func (*CodexProvider) Chat

func (p *CodexProvider) Chat(
	ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any,
) (*LLMResponse, error)

func (*CodexProvider) GetDefaultModel

func (p *CodexProvider) GetDefaultModel() string

func (*CodexProvider) SupportsNativeSearch

func (p *CodexProvider) SupportsNativeSearch() bool

type ContentBlock

type ContentBlock = protocoltypes.ContentBlock

type ExtraContent

type ExtraContent = protocoltypes.ExtraContent

type FunctionCall

type FunctionCall = protocoltypes.FunctionCall

type GoogleExtra

type GoogleExtra = protocoltypes.GoogleExtra

type LLMProvider

type LLMProvider interface {
	Chat(
		ctx context.Context,
		messages []Message,
		tools []ToolDefinition,
		model string,
		options map[string]any,
	) (*LLMResponse, error)
	GetDefaultModel() string
}

type LLMResponse

type LLMResponse = protocoltypes.LLMResponse

type Message

type Message = protocoltypes.Message

type ToolCall

type ToolCall = protocoltypes.ToolCall

type ToolDefinition

type ToolDefinition = protocoltypes.ToolDefinition

type ToolFunctionDefinition

type ToolFunctionDefinition = protocoltypes.ToolFunctionDefinition

type UsageInfo

type UsageInfo = protocoltypes.UsageInfo

Jump to

Keyboard shortcuts

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