yao/kb/providers/extractor.go
Max 7fa825a334 Remove obsolete configuration and test files for Knowledge Base
- Deleted config.go, config_test.go, types.go, and related test files to streamline the codebase and remove deprecated components.
- Refactored Knowledge Base loading logic to utilize updated configuration structures, enhancing clarity and maintainability.
- Updated references in kb.go to align with the new configuration types, ensuring compatibility with the latest changes.
2025-07-25 11:36:15 +08:00

41 lines
1.3 KiB
Go

package providers
import (
"github.com/yaoapp/gou/graphrag/extraction/openai"
"github.com/yaoapp/gou/graphrag/types"
"github.com/yaoapp/yao/kb/providers/factory"
kbtypes "github.com/yaoapp/yao/kb/types"
)
// ExtractorOpenAI is an extractor provider for entity and relationship extraction
type ExtractorOpenAI struct{}
// AutoRegister registers the extractor providers
func init() {
factory.Extractors["__yao.openai"] = &ExtractorOpenAI{}
}
// === ExtractorOpenAI ===
// Make creates a new OpenAI extractor
func (e *ExtractorOpenAI) Make(option *kbtypes.ProviderOption) (types.Extraction, error) {
// TODO: Map kbtypes.ProviderOption to openai.Options
openaiOptions := openai.Options{
// ConnectorName: "", // TODO: Get connector name from option
// Concurrent: 0, // Will use default
// Model: "", // Will use default
// Temperature: 0, // Will use default
// MaxTokens: 0, // Will use default
// Prompt: "", // Will use default
// Toolcall: nil, // Will use default
// Tools: nil, // Will use default
// RetryAttempts: 0, // Will use default
// RetryDelay: 0, // Will use default
}
return openai.NewOpenai(openaiOptions)
}
// Schema returns the schema for the OpenAI extractor
func (e *ExtractorOpenAI) Schema(provider *kbtypes.Provider) (*kbtypes.ProviderSchema, error) {
return nil, nil
}