provider

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package provider implements various LLM providers (Google, GitHub) for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialStore

type CredentialStore interface {
	GetWithFallback(p domain.Provider) (*domain.Credential, error)
}

CredentialStore defines the interface for active credential resolution.

type GitHubProvider

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

GitHubProvider implements the domain.Provider interface for GitHub Copilot.

func NewGitHubProvider

func NewGitHubProvider(models []domain.LLMInfo) *GitHubProvider

NewGitHubProvider creates a new GitHub provider factory.

func (*GitHubProvider) GetLLM

func (p *GitHubProvider) GetLLM(ctx context.Context, cred *domain.Credential, info domain.LLMInfo) (domain.LLM, error)

GetLLM initializes and returns a GitHub-backed LLM instance.

func (*GitHubProvider) ID

func (p *GitHubProvider) ID() string

ID returns the unique identifier for the GitHub provider.

func (*GitHubProvider) List

func (p *GitHubProvider) List() []domain.LLMInfo

List returns the available models provided by GitHub.

func (*GitHubProvider) SupportedAuthMethods

func (p *GitHubProvider) SupportedAuthMethods() []domain.AuthMethod

SupportedAuthMethods returns the list of authentication methods supported by GitHub.

type GoogleProvider

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

GoogleProvider implements the domain.Provider interface for Google Gemini.

func NewGoogleProvider

func NewGoogleProvider(models []domain.LLMInfo) *GoogleProvider

NewGoogleProvider creates a new Google provider factory.

func (*GoogleProvider) GetLLM

func (p *GoogleProvider) GetLLM(ctx context.Context, cred *domain.Credential, info domain.LLMInfo) (domain.LLM, error)

GetLLM initializes and returns a Google-backed LLM instance.

func (*GoogleProvider) ID

func (p *GoogleProvider) ID() string

ID returns the unique identifier for the Google provider.

func (*GoogleProvider) List

func (p *GoogleProvider) List() []domain.LLMInfo

List returns the available models provided by Google.

func (*GoogleProvider) SupportedAuthMethods

func (p *GoogleProvider) SupportedAuthMethods() []domain.AuthMethod

SupportedAuthMethods returns the list of authentication methods supported by Google.

type LLMRegistry

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

LLMRegistry orchestrates model resolution using a Registry and credentials.

func NewLLMRegistry

func NewLLMRegistry(authManager CredentialStore, providers *Registry) *LLMRegistry

NewLLMRegistry creates an LLMRegistry.

func (*LLMRegistry) Get

func (r *LLMRegistry) Get(ctx context.Context, id string) (domain.LLM, error)

Get resolves "google/gemini-2.5-flash" to an LLM instance.

func (*LLMRegistry) List

func (r *LLMRegistry) List(_ context.Context) ([]domain.LLMInfo, error)

List returns all LLMs from all providers.

type OpenCodeProvider added in v1.0.1

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

func NewOpenCodeProvider added in v1.0.1

func NewOpenCodeProvider(models []domain.LLMInfo) *OpenCodeProvider

func (*OpenCodeProvider) GetLLM added in v1.0.1

func (p *OpenCodeProvider) GetLLM(ctx context.Context, cred *domain.Credential, info domain.LLMInfo) (domain.LLM, error)

func (*OpenCodeProvider) ID added in v1.0.1

func (p *OpenCodeProvider) ID() string

func (*OpenCodeProvider) List added in v1.0.1

func (p *OpenCodeProvider) List() []domain.LLMInfo

func (*OpenCodeProvider) SupportedAuthMethods added in v1.0.1

func (p *OpenCodeProvider) SupportedAuthMethods() []domain.AuthMethod

type Registry

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

Registry manages the set of available LLM providers.

func NewRegistry

func NewRegistry(authManager CredentialStore, providers ...domain.Provider) *Registry

NewRegistry creates a Registry from providers and an optional auth manager.

func (*Registry) Get

func (r *Registry) Get(id string) (domain.Provider, bool)

Get returns a provider by its ID.

func (*Registry) List

func (r *Registry) List(_ context.Context) ([]domain.ProviderInfo, error)

List returns information about all registered providers, including resolved credentials.

type TokenSource

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

TokenSource manages the exchange of a long-lived GitHub OAuth token for short-lived Copilot session tokens.

func NewTokenSource

func NewTokenSource(oauthToken string, exchangeURL string) *TokenSource

NewTokenSource creates a new token source.

func (*TokenSource) Get

func (s *TokenSource) Get(ctx context.Context) (string, error)

Get returns a valid session token, exchanging if necessary.

Jump to

Keyboard shortcuts

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