copilot

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatOptions

type ChatOptions struct {
	Stream            bool
	DocumentRetrieval string
	Supplementary     string
	Instruction       string
	State             *ConversationState
}

ChatOptions holds options for chat operations

type ConversationContext

type ConversationContext struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

ConversationContext represents a context item for the conversation

type ConversationMessage

type ConversationMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

ConversationMessage represents a message in the conversation history

type ConversationRequest

type ConversationRequest struct {
	Text    string                `json:"text"`
	State   *ConversationState    `json:"state,omitempty"`
	Context []ConversationContext `json:"context,omitempty"`
}

ConversationRequest represents a request to the CoPilot conversation endpoint

type ConversationResponse

type ConversationResponse struct {
	Text  string             `json:"text"`
	State *ConversationState `json:"state,omitempty"`
}

ConversationResponse represents a response from the CoPilot conversation endpoint

type ConversationState

type ConversationState struct {
	Messages []ConversationMessage `json:"messages,omitempty"`
}

ConversationState represents the conversation state for multi-turn conversations

type DocumentMetadata

type DocumentMetadata struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version,omitempty"`
}

DocumentMetadata represents metadata about a document

type DocumentSearchRequest

type DocumentSearchRequest struct {
	Texts       []string `json:"texts"`
	Collections []string `json:"collections"`
	Exclude     []string `json:"exclude,omitempty"`
}

DocumentSearchRequest represents a request to search for documents

type DocumentSearchResponse

type DocumentSearchResponse struct {
	MessageToken string           `json:"messageToken"`
	Results      []ScoredDocument `json:"results"`
	Status       string           `json:"status"`
}

DocumentSearchResponse represents the response from document search

type DocumentSearchResult

type DocumentSearchResult struct {
	Documents []ScoredDocument
	Status    string
}

DocumentSearchResult is a processed result for display

type Dql2NlRequest

type Dql2NlRequest struct {
	DQL string `json:"dql"`
}

Dql2NlRequest represents a request to explain a DQL query

type Dql2NlResponse

type Dql2NlResponse struct {
	Summary      string `json:"summary"`
	Explanation  string `json:"explanation"`
	MessageToken string `json:"messageToken"`
	Status       string `json:"status"`
}

Dql2NlResponse represents the response from the DQL to NL skill

type Handler

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

Handler handles Davis CoPilot resources

func NewHandler

func NewHandler(c *httpclient.Client) *Handler

NewHandler creates a new copilot handler

func (*Handler) Chat

Chat sends a message to CoPilot and returns the response

func (*Handler) ChatStream

func (h *Handler) ChatStream(ctx context.Context, text string, state *ConversationState, convCtx []ConversationContext, callback func(chunk StreamChunk) error) (*ConversationResponse, error)

ChatStream sends a message to CoPilot and streams the response

func (*Handler) ChatWithOptions

func (h *Handler) ChatWithOptions(ctx context.Context, text string, opts ChatOptions, streamCallback func(chunk StreamChunk) error) (*ConversationResponse, error)

ChatWithOptions sends a message with options

func (*Handler) DocumentSearch

func (h *Handler) DocumentSearch(ctx context.Context, texts []string, collections []string, exclude []string) (*DocumentSearchResult, error)

DocumentSearch searches for relevant documents

func (*Handler) Dql2Nl

func (h *Handler) Dql2Nl(ctx context.Context, dql string) (*Dql2NlResponse, error)

Dql2Nl explains a DQL query in natural language

func (*Handler) ListSkills

func (h *Handler) ListSkills(ctx context.Context) (*SkillList, error)

ListSkills retrieves all available CoPilot skills

func (*Handler) Nl2Dql

func (h *Handler) Nl2Dql(ctx context.Context, text string) (*Nl2DqlResponse, error)

Nl2Dql converts natural language to a DQL query

type Nl2DqlRequest

type Nl2DqlRequest struct {
	Text string `json:"text"`
}

Nl2DqlRequest represents a request to convert natural language to DQL

type Nl2DqlResponse

type Nl2DqlResponse struct {
	DQL          string `json:"dql"`
	MessageToken string `json:"messageToken"`
	Status       string `json:"status"`
}

Nl2DqlResponse represents the response from the NL to DQL skill

type ScoredDocument

type ScoredDocument struct {
	DocumentID       string           `json:"documentId"`
	RelevanceScore   float64          `json:"relevanceScore"`
	DocumentMetadata DocumentMetadata `json:"documentMetadata"`
}

ScoredDocument represents a document with its relevance score

type Skill

type Skill struct {
	Name string
}

Skill represents an available CoPilot skill (just a string type)

type SkillList

type SkillList struct {
	Skills []Skill
}

SkillList is the processed list for display

type SkillsResponse

type SkillsResponse struct {
	Skills []string `json:"skills"`
}

SkillsResponse represents the list of available skills

type StreamChunk

type StreamChunk struct {
	Event string           `json:"event"`
	Data  *StreamChunkData `json:"data,omitempty"`
}

StreamChunk represents a chunk in a streaming response (ndjson event format)

type StreamChunkData

type StreamChunkData struct {
	Tokens       []string           `json:"tokens,omitempty"`
	Text         string             `json:"text,omitempty"`
	State        *ConversationState `json:"state,omitempty"`
	MessageToken string             `json:"messageToken,omitempty"`
	Type         string             `json:"type,omitempty"`
	Message      string             `json:"message,omitempty"`
}

StreamChunkData represents the data field in a streaming chunk

Jump to

Keyboard shortcuts

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