Documentation
¶
Index ¶
- type ArxivConfig
- type ArxivPaper
- type ArxivSource
- type GitHubCodeResult
- type GitHubConfig
- type GitHubRepo
- type GitHubSearchResponse
- type GitHubSource
- func (g *GitHubSource) GetReadme(ctx context.Context, owner, repo string) (string, error)
- func (g *GitHubSource) Name() string
- func (g *GitHubSource) SearchCode(ctx context.Context, query string, language string, maxResults int) ([]GitHubCodeResult, error)
- func (g *GitHubSource) SearchRepos(ctx context.Context, query string, maxResults int) ([]GitHubRepo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArxivConfig ¶
type ArxivConfig struct {
BaseURL string `json:"base_url"` // arXiv API base URL
MaxResults int `json:"max_results"` // Maximum results per query
SortBy string `json:"sort_by"` // "relevance", "lastUpdatedDate", "submittedDate"
SortOrder string `json:"sort_order"` // "ascending", "descending"
Timeout time.Duration `json:"timeout"` // HTTP request timeout
RetryCount int `json:"retry_count"` // Number of retries on failure
RetryDelay time.Duration `json:"retry_delay"` // Delay between retries
Categories []string `json:"categories"` // Filter by arXiv categories (e.g., "cs.AI", "cs.CL")
}
ArxivConfig配置了arXiv数据源适配器.
type ArxivPaper ¶
type ArxivPaper struct {
ID string `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"`
Authors []string `json:"authors"`
Categories []string `json:"categories"`
Published time.Time `json:"published"`
Updated time.Time `json:"updated"`
PDFURL string `json:"pdf_url"`
AbstractURL string `json:"abstract_url"`
DOI string `json:"doi,omitempty"`
Comment string `json:"comment,omitempty"`
}
ArxivPaper代表了ArXiv的论文.
type ArxivSource ¶
type ArxivSource struct {
// contains filtered or unexported fields
}
Arxiv Source提供对arXiv文件的访问,供RAG检索.
func NewArxivSource ¶
func NewArxivSource(config ArxivConfig, logger *zap.Logger) *ArxivSource
NewArxiv Source创建了新的arXiv数据源适配器.
func (*ArxivSource) Search ¶
func (a *ArxivSource) Search(ctx context.Context, query string, maxResults int) ([]ArxivPaper, error)
搜索匹配给定查询的文件 arXiv 。
func (*ArxivSource) ToJSON ¶
func (a *ArxivSource) ToJSON(papers []ArxivPaper) (string, error)
ToJSON将论文串行到JSON调试/博客.
type GitHubCodeResult ¶
type GitHubCodeResult struct {
Name string `json:"name"`
Path string `json:"path"`
HTMLURL string `json:"html_url"`
Repository struct {
FullName string `json:"full_name"`
Description string `json:"description"`
HTMLURL string `json:"html_url"`
} `json:"repository"`
Score float64 `json:"score"`
}
GitHubCodeResult代表了由GitHub生成的代码搜索结果.
type GitHubConfig ¶
type GitHubConfig struct {
BaseURL string `json:"base_url"` // GitHub API base URL
Token string `json:"-"` // GitHub personal access token (not serialized)
MaxResults int `json:"max_results"` // Maximum results per query
Timeout time.Duration `json:"timeout"` // HTTP request timeout
RetryCount int `json:"retry_count"` // Number of retries on failure
RetryDelay time.Duration `json:"retry_delay"` // Delay between retries
}
GitHubConfig 配置了 GitHub 数据源适配器.
func DefaultGitHubConfig ¶
func DefaultGitHubConfig() GitHubConfig
GitHubConfig 返回 GitHub 查询的合理默认值 。
type GitHubRepo ¶
type GitHubRepo struct {
FullName string `json:"full_name"`
Description string `json:"description"`
URL string `json:"html_url"`
Stars int `json:"stargazers_count"`
Forks int `json:"forks_count"`
Language string `json:"language"`
Topics []string `json:"topics"`
UpdatedAt time.Time `json:"updated_at"`
License string `json:"license_name,omitempty"`
OpenIssues int `json:"open_issues_count"`
ReadmeURL string `json:"readme_url,omitempty"`
}
GitHubRepo代表一个GitHub寄存器.
func FilterByLanguage ¶
func FilterByLanguage(repos []GitHubRepo, language string) []GitHubRepo
FilterByLanguage过滤器通过编程语言重置.
func FilterByStars ¶
func FilterByStars(repos []GitHubRepo, minStars int) []GitHubRepo
FilterByStars 过滤器通过最小星数重置.
type GitHubSearchResponse ¶
type GitHubSearchResponse struct {
TotalCount int `json:"total_count"`
Items []GitHubRepo `json:"items"`
}
GitHubSearchResponse代表了GitHub搜索API响应.
type GitHubSource ¶
type GitHubSource struct {
// contains filtered or unexported fields
}
GitHub Source提供对GitHub寄存器的访问,供RAG检索.
func NewGitHubSource ¶
func NewGitHubSource(config GitHubConfig, logger *zap.Logger) *GitHubSource
NewGitHub Source创建了新的GitHub数据源适配器.
func (*GitHubSource) SearchCode ¶
func (g *GitHubSource) SearchCode(ctx context.Context, query string, language string, maxResults int) ([]GitHubCodeResult, error)
搜索代码搜索 GitHub 以匹配查询代码 。
func (*GitHubSource) SearchRepos ¶
func (g *GitHubSource) SearchRepos(ctx context.Context, query string, maxResults int) ([]GitHubRepo, error)
SearchRepos 搜索匹配查询的 GitHub 寄存器 。
Click to show internal directories.
Click to hide internal directories.