llm_client.go 526 B

12345678910111213141516171819202122232425
  1. package llm
  2. import (
  3. "net/http"
  4. "time"
  5. )
  6. type LLMClient struct {
  7. BaseURL string
  8. HttpClient *http.Client
  9. }
  10. func NewLLMClient(baseURL string, timeout time.Duration) *LLMClient {
  11. return &LLMClient{
  12. BaseURL: baseURL,
  13. HttpClient: &http.Client{
  14. Timeout: timeout * time.Second,
  15. },
  16. }
  17. }
  18. type LLMService interface {
  19. KnowledgeBaseChat(query string, KnowledgeBaseName string, history []string) (llmRes *http.Response, err error)
  20. SearchKbDocs(query string, KnowledgeBaseName string) (data interface{}, err error)
  21. }