This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: postprocessors in retrieval flow
- Loading branch information
1 parent
19837ab
commit 3be046a
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
// Package postprocessors is basically the same as package transformers, but used at a different stage of the RAG pipeline | ||
package postprocessors | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gptscript-ai/knowledge/pkg/datastore/transformers" | ||
"github.com/gptscript-ai/knowledge/pkg/datastore/types" | ||
) | ||
|
||
// Postprocessor may be a "normal" | ||
type Postprocessor types.DocumentTransformer | ||
|
||
var PostprocessorMap = map[string]Postprocessor{} | ||
|
||
func GetPostprocessor(name string) (Postprocessor, error) { | ||
var postprocessor Postprocessor | ||
var ok bool | ||
postprocessor, ok = PostprocessorMap[name] | ||
if !ok { | ||
var err error | ||
postprocessor, err = transformers.GetTransformer(name) | ||
if err != nil { | ||
return nil, fmt.Errorf("unknown postprocessor %q", name) | ||
} | ||
} | ||
return postprocessor, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters