Documentation
¶
Index ¶
- type ChatOptions
- type ConversationContext
- type ConversationMessage
- type ConversationRequest
- type ConversationResponse
- type ConversationState
- type DocumentMetadata
- type DocumentSearchRequest
- type DocumentSearchResponse
- type DocumentSearchResult
- type Dql2NlRequest
- type Dql2NlResponse
- type Handler
- func (h *Handler) Chat(ctx context.Context, text string, state *ConversationState, ...) (*ConversationResponse, error)
- func (h *Handler) ChatStream(ctx context.Context, text string, state *ConversationState, ...) (*ConversationResponse, error)
- func (h *Handler) ChatWithOptions(ctx context.Context, text string, opts ChatOptions, ...) (*ConversationResponse, error)
- func (h *Handler) DocumentSearch(ctx context.Context, texts []string, collections []string, exclude []string) (*DocumentSearchResult, error)
- func (h *Handler) Dql2Nl(ctx context.Context, dql string) (*Dql2NlResponse, error)
- func (h *Handler) ListSkills(ctx context.Context) (*SkillList, error)
- func (h *Handler) Nl2Dql(ctx context.Context, text string) (*Nl2DqlResponse, error)
- type Nl2DqlRequest
- type Nl2DqlResponse
- type ScoredDocument
- type Skill
- type SkillList
- type SkillsResponse
- type StreamChunk
- type StreamChunkData
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 ¶
ConversationContext represents a context item for the conversation
type ConversationMessage ¶
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 ¶
func (h *Handler) Chat(ctx context.Context, text string, state *ConversationState, convCtx []ConversationContext) (*ConversationResponse, error)
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) ListSkills ¶
ListSkills retrieves all available CoPilot skills
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