Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
add: cohere_rerank postprocessor + expand env vars in flows config (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 authored Jun 24, 2024
1 parent 28e6220 commit d0fe45e
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 88 deletions.
22 changes: 22 additions & 0 deletions examples/rerank.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
flows:
foo:
default: false
ingestion:
- filetypes: [".md"]
documentloader:
name: plaintext
textsplitter:
name: markdown
transformers:
- name: filter_markdown_docs_no_content
retrieval:
retriever:
name: basic
options:
topK: 25
postprocessors:
- name: cohere_rerank
options:
apiKey: ${COHERE_API_KEY}
topN: 3
model: rerank-multilingual-v3.0
57 changes: 29 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/gptscript-ai/knowledge

go 1.22.0
go 1.22.3

toolchain go1.22.4

replace (
github.com/philippgille/chromem-go => github.com/iwilltry42/chromem-go v0.0.0-20240513080122-88f1efa639f5 // Azure OpenAI support
Expand All @@ -15,12 +17,13 @@ require (
github.com/acorn-io/cmd v0.0.0-20240404013709-34f690bde37b
github.com/acorn-io/z v0.0.0-20231104012607-4cab1b3ec5e5
github.com/adrg/xdg v0.4.0
github.com/cohere-ai/cohere-go/v2 v2.8.2
github.com/gabriel-vasile/mimetype v1.4.3
github.com/gen2brain/go-fitz v1.23.7
github.com/gin-gonic/gin v1.9.1
github.com/glebarez/sqlite v1.11.0
github.com/google/uuid v1.6.0
github.com/hupe1980/golc v0.0.110
github.com/hupe1980/golc v0.0.112
github.com/lu4p/cat v0.1.5
github.com/mitchellh/mapstructure v1.5.0
github.com/philippgille/chromem-go v0.6.0
Expand All @@ -36,33 +39,32 @@ require (
)

require (
cloud.google.com/go/ai v0.5.0 // indirect
cloud.google.com/go/ai v0.7.0 // indirect
github.com/AssemblyAI/assemblyai-go-sdk v1.3.0 // indirect
github.com/EndFirstCorp/peekingReader v0.0.0-20171012052444-257fb6f1a1a6 // indirect
github.com/JalfResi/justext v0.0.0-20170829062021-c0282dea7198 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/advancedlogic/GoOse v0.0.0-20191112112754-e742535969c1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/araddon/dateparse v0.0.0-20200409225146-d820a6159ab1 // indirect
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.27.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/service/textract v1.30.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.9.2 // indirect
github.com/aws/aws-sdk-go-v2/service/textract v1.30.11 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cohere-ai/cohere-go/v2 v2.7.0 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/cohere-ai/tokenizer v1.1.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -73,7 +75,7 @@ require (
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.11.0 // indirect
github.com/go-git/go-git/v5 v5.12.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
Expand All @@ -89,7 +91,7 @@ require (
github.com/gorilla/css v1.0.0 // indirect
github.com/hupe1980/go-promptlayer v0.0.6 // indirect
github.com/hupe1980/go-textractor v0.0.9 // indirect
github.com/hupe1980/go-tiktoken v0.0.6 // indirect
github.com/hupe1980/go-tiktoken v0.0.9 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand Down Expand Up @@ -121,34 +123,33 @@ require (
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sashabaranov/go-openai v1.20.4 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sashabaranov/go-openai v1.26.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/serpapi/google-search-results-golang v0.0.0-20240325113416-ec93f510648e // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/unidoc/unioffice v1.30.0 // indirect
github.com/unidoc/unioffice v1.33.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181 // indirect
gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 // indirect
gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a // indirect
gitlab.com/golang-commonmark/mdurl v0.0.0-20191124015652-932350d1cb84 // indirect
gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/api v0.180.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240506185236-b8a5c65736ae // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/api v0.184.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.5 // indirect
Expand Down
Loading

0 comments on commit d0fe45e

Please sign in to comment.