Documentation
¶
Index ¶
- func CopilotModelNames(models []CopilotModel) []string
- func DefaultCopilotPickerModelNames() []string
- func FetchTokens(authVal config.AuthVal) (config.AuthVal, error)
- func MakeOauthRequest(provider string, model string, reasoningEffort string, ...) (*openai.ChatCompletion, error)
- func RefreshSavedCopilotModels() error
- func SaveAccessToken(token string) error
- func SaveCodexAuth(authVal config.AuthVal) error
- func WaitForCodexAuth(device DeviceCodeResponse) (config.AuthVal, error)
- func WaitForCodexLogin(flow CodexLoginFlow) (config.AuthVal, error)
- type AuthResponse
- type CodexBrowserAuthFlow
- type CodexLoginFlow
- type CopilotChatChoice
- type CopilotChatCompletionRequest
- type CopilotChatCompletionResponse
- type CopilotChatMessage
- type CopilotChatResponseMessage
- type CopilotChatTool
- type CopilotChatToolCall
- type CopilotChatToolFunction
- type CopilotChatUsage
- type CopilotModel
- type CopilotModelCapabilities
- type CopilotModelLimits
- type CopilotModelPolicy
- type CopilotModelSupports
- type CopilotModelVisionLimits
- type CopilotReasoning
- type CopilotResponsesContentPart
- type CopilotResponsesInputItem
- type CopilotResponsesOutputContent
- type CopilotResponsesOutputItem
- type CopilotResponsesRequest
- type CopilotResponsesResponse
- type CopilotResponsesTool
- type CopilotResponsesUsage
- type CopilotTextOptions
- type CopilotToolFunction
- type DeviceCodeResponse
- type InputTokenDetails
- type OutputTokenDetails
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopilotModelNames ¶ added in v1.2.4
func CopilotModelNames(models []CopilotModel) []string
CopilotModelNames returns the display names for live models returned by MakeModelsRequest, in the order the API returned them.
func DefaultCopilotPickerModelNames ¶
func DefaultCopilotPickerModelNames() []string
func MakeOauthRequest ¶
func RefreshSavedCopilotModels ¶
func RefreshSavedCopilotModels() error
func SaveAccessToken ¶
func SaveCodexAuth ¶
func WaitForCodexAuth ¶
func WaitForCodexAuth(device DeviceCodeResponse) (config.AuthVal, error)
func WaitForCodexLogin ¶
func WaitForCodexLogin(flow CodexLoginFlow) (config.AuthVal, error)
Types ¶
type AuthResponse ¶
type AuthResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
func PollForAccessToken ¶
func PollForAccessToken(deviceCode string) (AuthResponse, error)
func WaitForAccessToken ¶
func WaitForAccessToken(device DeviceCodeResponse) (AuthResponse, error)
type CodexBrowserAuthFlow ¶
type CodexBrowserAuthFlow struct {
// contains filtered or unexported fields
}
func StartCodexBrowserAuthFlow ¶
func StartCodexBrowserAuthFlow() (*CodexBrowserAuthFlow, error)
func (*CodexBrowserAuthFlow) AuthURL ¶
func (f *CodexBrowserAuthFlow) AuthURL() string
type CodexLoginFlow ¶
type CodexLoginFlow struct {
AuthURL string
Device *DeviceCodeResponse
Browser *CodexBrowserAuthFlow
}
func StartCodexLoginFlow ¶
func StartCodexLoginFlow() (CodexLoginFlow, error)
type CopilotChatChoice ¶
type CopilotChatChoice struct {
Index int `json:"index"`
Message CopilotChatResponseMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
type CopilotChatCompletionRequest ¶
type CopilotChatCompletionRequest struct {
Model string `json:"model"`
Messages []CopilotChatMessage `json:"messages"`
Tools []CopilotChatTool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
Stream bool `json:"stream,omitempty"`
}
type CopilotChatCompletionResponse ¶
type CopilotChatCompletionResponse struct {
ID string `json:"id"`
Choices []CopilotChatChoice `json:"choices"`
Usage CopilotChatUsage `json:"usage"`
}
func MakeCopilotChatCompletionRequest ¶
func MakeCopilotChatCompletionRequest(request CopilotChatCompletionRequest) (CopilotChatCompletionResponse, error)
type CopilotChatMessage ¶
type CopilotChatMessage struct {
Role string `json:"role"`
Content any `json:"content,omitempty"`
ToolCalls []CopilotChatToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
type CopilotChatResponseMessage ¶
type CopilotChatResponseMessage struct {
Role string `json:"role"`
Content string `json:"content"`
ReasoningOpaque string `json:"reasoning_opaque,omitempty"`
ToolCalls []CopilotChatToolCall `json:"tool_calls,omitempty"`
}
type CopilotChatTool ¶
type CopilotChatTool struct {
Type string `json:"type"`
Function CopilotToolFunction `json:"function"`
}
type CopilotChatToolCall ¶
type CopilotChatToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function CopilotChatToolFunction `json:"function"`
}
type CopilotChatToolFunction ¶
type CopilotChatUsage ¶
type CopilotModel ¶
type CopilotModel struct {
ID string `json:"id"`
ModelPickerCategory string `json:"model_picker_category"`
ModelPickerEnabled bool `json:"model_picker_enabled"`
Name string `json:"name"`
Object string `json:"object"`
Policy CopilotModelPolicy `json:"policy"`
Preview bool `json:"preview"`
SupportedEndpoints []string `json:"supported_endpoints"`
Vendor string `json:"vendor"`
Version string `json:"version"`
Capabilities CopilotModelCapabilities `json:"capabilities"`
}
func MakeModelsRequest ¶
func MakeModelsRequest() ([]CopilotModel, error)
func ResolveCopilotModel ¶
func ResolveCopilotModel(name string, liveModels []CopilotModel) (CopilotModel, bool)
type CopilotModelCapabilities ¶
type CopilotModelCapabilities struct {
Family string `json:"family"`
Limits CopilotModelLimits `json:"limits"`
Object string `json:"object"`
Supports CopilotModelSupports `json:"supports"`
Tokenizer string `json:"tokenizer"`
Type string `json:"type"`
}
type CopilotModelLimits ¶
type CopilotModelLimits struct {
MaxContextWindowTokens int `json:"max_context_window_tokens"`
MaxNonStreamingOutputTokens int `json:"max_non_streaming_output_tokens"`
MaxOutputTokens int `json:"max_output_tokens"`
MaxPromptTokens int `json:"max_prompt_tokens"`
Vision CopilotModelVisionLimits `json:"vision"`
}
type CopilotModelPolicy ¶
type CopilotModelSupports ¶
type CopilotModelSupports struct {
AdaptiveThinking bool `json:"adaptive_thinking"`
MaxThinkingBudget int `json:"max_thinking_budget"`
MinThinkingBudget int `json:"min_thinking_budget"`
ParallelToolCalls bool `json:"parallel_tool_calls"`
ReasoningEffort []string `json:"reasoning_effort"`
Streaming bool `json:"streaming"`
StructuredOutputs bool `json:"structured_outputs"`
ToolCalls bool `json:"tool_calls"`
Vision bool `json:"vision"`
}
type CopilotReasoning ¶
type CopilotResponsesInputItem ¶
type CopilotResponsesInputItem struct {
Role string `json:"role,omitempty"`
Content any `json:"content,omitempty"`
Type string `json:"type,omitempty"`
CallID string `json:"call_id,omitempty"`
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
Output string `json:"output,omitempty"`
}
type CopilotResponsesRequest ¶
type CopilotResponsesRequest struct {
Model string `json:"model"`
Input []CopilotResponsesInputItem `json:"input"`
Tools []CopilotResponsesTool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Reasoning *CopilotReasoning `json:"reasoning,omitempty"`
Include []string `json:"include,omitempty"`
Text *CopilotTextOptions `json:"text,omitempty"`
Stream bool `json:"stream,omitempty"`
}
type CopilotResponsesResponse ¶
type CopilotResponsesResponse struct {
ID string `json:"id,omitempty"`
Output []CopilotResponsesOutputItem `json:"output"`
Usage CopilotResponsesUsage `json:"usage"`
}
func MakeCopilotResponsesRequest ¶
func MakeCopilotResponsesRequest(request CopilotResponsesRequest) (CopilotResponsesResponse, error)
type CopilotResponsesTool ¶
type CopilotResponsesUsage ¶
type CopilotTextOptions ¶
type CopilotTextOptions struct {
Verbosity string `json:"verbosity,omitempty"`
}
type CopilotToolFunction ¶
type DeviceCodeResponse ¶
type DeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
func StartAuthFlow ¶
func StartAuthFlow() (DeviceCodeResponse, error)
func StartCodexAuthFlow ¶
func StartCodexAuthFlow() (DeviceCodeResponse, error)
type InputTokenDetails ¶
type InputTokenDetails struct {
CachedTokens int64 `json:"cached_tokens"`
}
type OutputTokenDetails ¶
type OutputTokenDetails struct {
ReasoningTokens int64 `json:"reasoning_tokens"`
}
type Usage ¶
type Usage struct {
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
TotalTokens int64 `json:"total_tokens"`
InputTokenDetails InputTokenDetails `json:"input_tokens_details"`
OutputTokenDetails OutputTokenDetails `json:"output_tokens_details"`
}
Click to show internal directories.
Click to hide internal directories.