Crate copilot_client

Source
Expand description

§GitHub Copilot Client Library

This library provides a client for interacting with the GitHub Copilot API. It handles token management, model retrieval, chat completions, and embeddings requests. The client uses reqwest for HTTP requests and serde for JSON serialization/deserialization.

§Features

  • Retrieve a GitHub token from the environment or configuration files.
  • Fetch available Copilot models and agents.
  • Send chat completion requests and receive responses.
  • Request embeddings for provided input strings.

Structs§

Agent
Represents an agent returned by the GitHub Copilot API.
AgentsResponse
Response payload for retrieving agents.
ChatChoice
Represents a single choice in a chat completion response.
ChatRequest
Request payload for a chat completion.
ChatResponse
Response payload for a chat completion request.
CopilotClient
Client for interacting with the GitHub Copilot API.
CopilotTokenResponse
Response from the GitHub Copilot token endpoint.
Embedding
Represents an individual embedding.
EmbeddingRequest
Request payload for an embeddings request.
EmbeddingResponse
Response payload for an embeddings request.
Message
Represents a chat message.
Model
Represents a model available for GitHub Copilot.
ModelsResponse
Response payload for retrieving models.
TokenUsage
Information about token usage in a chat response.

Enums§

CopilotError
Represents errors that can occur when interacting with the GitHub Copilot API.

Functions§

get_config_path
Returns the user’s configuration directory.
get_github_token
Retrieves the GitHub token from the GITHUB_TOKEN environment variable or from a configuration file.