Documentation
¶
Index ¶
- Constants
- type AgentResponse
- type Analytic
- type Analytics
- type ChatbotResponse
- type CodeBlock
- type CodeExtractor
- func (ce *CodeExtractor) ExtractAllSegments(markdownText string) ExtractedSegments
- func (ce *CodeExtractor) ExtractCodeBlocks(markdownText string) []CodeBlock
- func (ce *CodeExtractor) ExtractInlineCode(markdownText string) []string
- func (ce *CodeExtractor) ExtractJSONBlocks(markdownText string) []JSONBlock
- func (ce *CodeExtractor) ExtractSQLBlocks(markdownText string) []SQLBlock
- func (ce *CodeExtractor) FilterCodeBlocksByLanguage(codeBlocks []CodeBlock, languages []string) []CodeBlock
- func (ce *CodeExtractor) PrettyPrintJSON(jsonStr string) (string, error)
- func (ce *CodeExtractor) ValidateJSON(jsonStr string) error
- type ColumnInfo
- type ConstraintInfo
- type ExtractedSegments
- type ForeignKeyInfo
- type IndexInfo
- type JSONBlock
- type RAGConfig
- type RAGPineconeGemini
- func (r *RAGPineconeGemini) Embed(text string) ([]float32, error)
- func (r *RAGPineconeGemini) Match(namespace string, query string, topK int) ([]*pinecone.ScoredVector, error)
- func (r *RAGPineconeGemini) QueryAgent(namespace string, schema string, query string, topK int) (*AgentResponse, error)
- func (r *RAGPineconeGemini) QueryChat(query string) (ChatbotResponse, error)
- func (r *RAGPineconeGemini) Report(analytics string, schema string) (string, error)
- type RAGmodel
- type SQLBlock
- type Schema
- type Table
- type TableColumn
- type TableInfo
Constants ¶
const ( CHATBOT_PROMPT_TEMPLATE = `` /* 917-byte string literal not displayed */ AGENT_PROMPT_TEMPLATE = `` /* 3051-byte string literal not displayed */ REPORT_PROMPT_TEMPLATE = `` /* 1216-byte string literal not displayed */ )
const (
DEFAULT_TOP_K = 5
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentResponse ¶
type ChatbotResponse ¶ added in v1.0.1
type CodeExtractor ¶ added in v1.0.8
type CodeExtractor struct {
// contains filtered or unexported fields
}
CodeExtractor handles extraction of code segments from markdown
func NewCodeExtractor ¶ added in v1.0.8
func NewCodeExtractor() *CodeExtractor
NewCodeExtractor creates a new CodeExtractor instance
func (*CodeExtractor) ExtractAllSegments ¶ added in v1.0.8
func (ce *CodeExtractor) ExtractAllSegments(markdownText string) ExtractedSegments
ExtractAllSegments extracts both JSON and SQL segments
func (*CodeExtractor) ExtractCodeBlocks ¶ added in v1.0.8
func (ce *CodeExtractor) ExtractCodeBlocks(markdownText string) []CodeBlock
ExtractCodeBlocks extracts all code blocks from markdown text
func (*CodeExtractor) ExtractInlineCode ¶ added in v1.0.8
func (ce *CodeExtractor) ExtractInlineCode(markdownText string) []string
ExtractInlineCode extracts inline code segments (text wrapped in backticks)
func (*CodeExtractor) ExtractJSONBlocks ¶ added in v1.0.8
func (ce *CodeExtractor) ExtractJSONBlocks(markdownText string) []JSONBlock
ExtractJSONBlocks extracts and parses JSON code blocks
func (*CodeExtractor) ExtractSQLBlocks ¶ added in v1.0.8
func (ce *CodeExtractor) ExtractSQLBlocks(markdownText string) []SQLBlock
ExtractSQLBlocks extracts SQL code blocks
func (*CodeExtractor) FilterCodeBlocksByLanguage ¶ added in v1.0.8
func (ce *CodeExtractor) FilterCodeBlocksByLanguage(codeBlocks []CodeBlock, languages []string) []CodeBlock
FilterCodeBlocksByLanguage filters code blocks by specific language
func (*CodeExtractor) PrettyPrintJSON ¶ added in v1.0.8
func (ce *CodeExtractor) PrettyPrintJSON(jsonStr string) (string, error)
PrettyPrintJSON formats JSON string with indentation
func (*CodeExtractor) ValidateJSON ¶ added in v1.0.8
func (ce *CodeExtractor) ValidateJSON(jsonStr string) error
ValidateJSON validates if a JSON string is valid
type ColumnInfo ¶
type ConstraintInfo ¶ added in v1.0.7
type ConstraintInfo struct { TableName string `db:"table_name" json:"TableName"` ConstraintName string `db:"constraint_name" json:"ConstraintName"` ConstraintType string `db:"constraint_type" json:"ConstraintType"` ColumnName *string `db:"column_name" json:"ColumnName"` ForeignTableName *string `db:"foreign_table_name" json:"ForeignTableName"` ForeignColumnName *string `db:"foreign_column_name" json:"ForeignColumnName"` CheckClause *string `db:"check_clause" json:"CheckClause"` OrdinalPosition *int `db:"ordinal_position" json:"OrdinalPosition"` }
ConstraintInfo represents database constraints
type ExtractedSegments ¶ added in v1.0.8
type ExtractedSegments struct { JSONBlocks []JSONBlock `json:"json_blocks"` SQLBlocks []SQLBlock `json:"sql_blocks"` AllCodeBlocks []CodeBlock `json:"all_code_blocks"` }
ExtractedSegments contains all extracted code segments
type ForeignKeyInfo ¶
type IndexInfo ¶ added in v1.0.7
type IndexInfo struct { TableName string `db:"table_name" json:"TableName"` IndexName string `db:"index_name" json:"IndexName"` ColumnName string `db:"column_name" json:"ColumnName"` IsUnique bool `db:"is_unique" json:"IsUnique"` IndexType string `db:"index_type" json:"IndexType"` IsPrimary bool `db:"is_primary" json:"IsPrimary"` }
IndexInfo represents database indexes
type JSONBlock ¶ added in v1.0.8
type JSONBlock struct { RawCode string `json:"raw_code"` ParsedJSON interface{} `json:"parsed_json,omitempty"` Language string `json:"language"` Error string `json:"error,omitempty"` }
JSONBlock represents a JSON code block with parsed data
type RAGPineconeGemini ¶
type RAGPineconeGemini struct { DbClient *pinecone.Client IndexConn *pinecone.IndexConnection GeminiClient *genai.Client IndexHost string EmbeddingModel *genai.EmbeddingModel GenerativeModel *genai.GenerativeModel }
func (*RAGPineconeGemini) Embed ¶
func (r *RAGPineconeGemini) Embed(text string) ([]float32, error)
implement the RAGmodel interface for the RAGConfig
func (*RAGPineconeGemini) Match ¶
func (r *RAGPineconeGemini) Match(namespace string, query string, topK int) ([]*pinecone.ScoredVector, error)
func (*RAGPineconeGemini) QueryAgent ¶
func (r *RAGPineconeGemini) QueryAgent(namespace string, schema string, query string, topK int) (*AgentResponse, error)
QueryAgent queries the agent with the given namespace, schema, query, and topK this is the main function that will be used to query in agent mode and get the response
func (*RAGPineconeGemini) QueryChat ¶ added in v1.0.3
func (r *RAGPineconeGemini) QueryChat(query string) (ChatbotResponse, error)
QueryChat implements a specialized version of query for chat interactions It retrieves data from the vector database using the specified namespace and formats a response using the chatbot prompt template
type RAGmodel ¶
type RAGmodel interface { Embed(text string) ([]float32, error) Match(namespace string, query string, topK int) ([]*pinecone.ScoredVector, error) QueryAgent(namespace string, schema string, query string, topK int) (*AgentResponse, error) Report(analytics string, schema string) (string, error) QueryChat(query string) (ChatbotResponse, error) }
func GetRAGTest ¶
func GetRAGTest() RAGmodel
type SQLBlock ¶ added in v1.0.8
type SQLBlock struct { Code string `json:"code"` Language string `json:"language"` QueryType string `json:"query_type"` }
SQLBlock represents a SQL code block with query type
type Table ¶ added in v1.0.7
type Table struct { TableName string `db:"table_name" json:"TableName"` Columns []TableColumn `db:"columns" json:"Columns"` Constraints []ConstraintInfo `db:"constraints" json:"Constraints"` Indexes []IndexInfo `db:"indexes" json:"Indexes"` }
type TableColumn ¶ added in v1.0.7
type TableColumn struct { TableName string `db:"table_name" json:"TableName"` ColumnName string `db:"column_name" json:"ColumnName"` DataType string `db:"data_type" json:"DataType"` IsNullable bool `db:"is_nullable" json:"IsNullable"` ColumnDefault *string `db:"column_default" json:"ColumnDefault"` CharacterMaximumLength *int `db:"character_maximum_length" json:"CharacterMaximumLength"` NumericPrecision *int `db:"numeric_precision" json:"NumericPrecision"` NumericScale *int `db:"numeric_scale" json:"NumericScale"` OrdinalPosition int `db:"ordinal_position" json:"OrdinalPosition"` }
TableColumn represents a database column with its properties
type TableInfo ¶
type TableInfo struct { Columns map[string]ColumnInfo `json:"COLUMNS"` PrimaryKeys []string `json:"PRIMARY_KEYS"` ForeignKeys []ForeignKeyInfo `json:"FOREIGN_KEYS"` Checks []interface{} `json:"CHECKS"` Indexes [][]string `json:"INDEXES"` Comment *string `json:"COMMENT"` }