Skip to content

Commit

Permalink
Merge pull request #34 from wesen/misc/update-for-new-api
Browse files Browse the repository at this point in the history
Update embeddings config and add RAG query example
  • Loading branch information
wesen authored Feb 20, 2025
2 parents 8c9851e + 75208fa commit fe9f77a
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 58 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: '>=1.19.5'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=5m
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: '>=1.19.5'
cache: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: '>=1.19.5'
cache: true
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/delete-by-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"encoding/json"
"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"io"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/multi-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"io"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"context"
"encoding/json"
"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/documents/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/indices/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"bytes"
"context"
"encoding/json"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
7 changes: 4 additions & 3 deletions cmd/escuse-me/cmds/indices/close.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package indices
import (
"context"
"encoding/json"
"io"
"strings"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
"github.com/go-go-golems/glazed/pkg/middlewares"
"github.com/go-go-golems/glazed/pkg/settings"
"github.com/go-go-golems/glazed/pkg/types"
"github.com/pkg/errors"
"io"
"strings"
)

type CloseIndexCommand struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/indices/create-index.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"io"

"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
7 changes: 4 additions & 3 deletions cmd/escuse-me/cmds/indices/delete-index.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package indices
import (
"context"
"encoding/json"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
"io"
"strings"

es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
"github.com/go-go-golems/glazed/pkg/middlewares"
"github.com/go-go-golems/glazed/pkg/settings"
"github.com/go-go-golems/glazed/pkg/types"
"github.com/pkg/errors"
"io"
"strings"
)

type DeleteIndexCommand struct {
Expand Down
7 changes: 4 additions & 3 deletions cmd/escuse-me/cmds/indices/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package indices
import (
"context"
"encoding/json"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
"io"
"strings"

es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
"github.com/go-go-golems/glazed/pkg/middlewares"
"github.com/go-go-golems/glazed/pkg/settings"
"github.com/go-go-golems/glazed/pkg/types"
"github.com/pkg/errors"
"io"
"strings"
)

type FlushCommand struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/escuse-me/cmds/indices/update-mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"

"github.com/elastic/go-elasticsearch/v8/esapi"
"github.com/go-go-golems/escuse-me/cmd/escuse-me/pkg/helpers"
es_layers "github.com/go-go-golems/escuse-me/pkg/cmds/layers"
"github.com/go-go-golems/escuse-me/pkg/helpers"
"github.com/go-go-golems/glazed/pkg/cmds"
"github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
Expand Down
14 changes: 14 additions & 0 deletions cmd/escuse-me/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,20 @@ func initAllCommands(helpSystem *help.HelpSystem) error {
ls_commands.WithCommandDescriptionOptions(
glazed_cmds.WithShort("Commands related to sqleton queries"),
),
ls_commands.WithAddCommandToRowFunc(func(
command glazed_cmds.Command,
row types.Row,
parsedLayers *glazed_layers.ParsedLayers,
) ([]types.Row, error) {
ret := []types.Row{row}
switch command.(type) {
case *es_cmds.ElasticSearchCommand:
row.Set("type", "escuse-me")
default:
}

return ret, nil
}),
)

if err != nil {
Expand Down
87 changes: 87 additions & 0 deletions cmd/escuse-me/queries/examples/rag-query.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: "rag-query"
short: "Execute RAG queries across indexes"
long: "Execute RAG (Retrieval Augmented Generation) queries across multiple indexes with support for metadata filtering and additional fields"

flags:
- name: query_text
type: string
help: "The main query text to search for"
required: true
- name: index_names
type: stringList
help: "Optional list of indexes to query (uses default indexes if not specified)"
- name: slack_user_id
type: int
help: "Optional Slack user ID for filtering"
- name: slack_app_installation_id
type: int
help: "Optional Slack app installation ID for filtering"
- name: external_uuid
type: string
help: "Optional external UUID for tracking"
- name: show_vectors
type: bool
default: false
help: "Show vector fields in the output"
- name: show_raw_query
type: bool
default: false
help: "Show the raw Elasticsearch query"
- name: size
type: int
default: 10
help: "Number of results to return per index"
- name: fuzziness
type: string
default: "AUTO"
help: "Fuzziness level for text matching (AUTO, 0, 1, 2)"

query:
_source: !Concat
- ["id", "content", "metadata", "created_at", "updated_at", "title", "name", "real_name", "subject", "insight_type"]
- !If
test: !Var show_vectors
then: ["content_vector", "metadata_vector"]
else: !Void
size: !Var size
aggs:
insight_types:
terms:
field: "insight_type"
size: 20
query:
bool:
must: !Concat
- !If
test: !Exists query_text
then:
- multi_match:
query: !Var query_text
fields: [
"title^3",
"name",
"real_name",
"subject",
"content^2",
"metadata.*"
]
fuzziness: !Var fuzziness
else: !Void
- !If
test: !Exists slack_user_id
then:
- term:
slack_user_id: !Var slack_user_id
else: !Void
- !If
test: !Exists slack_app_installation_id
then:
- term:
slack_app_installation_id: !Var slack_app_installation_id
else: !Void
- !If
test: !Exists external_uuid
then:
- term:
external_uuid: !Var external_uuid
else: !Void
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ toolchain go1.23.3

require (
github.com/elastic/go-elasticsearch/v8 v8.17.0
github.com/go-go-golems/clay v0.1.27
github.com/go-go-golems/geppetto v0.4.34
github.com/go-go-golems/glazed v0.5.29
github.com/go-go-golems/clay v0.1.31
github.com/go-go-golems/geppetto v0.4.36
github.com/go-go-golems/glazed v0.5.34
github.com/go-go-golems/go-emrichen v0.0.4
github.com/go-go-golems/parka v0.5.18
github.com/go-go-golems/parka v0.5.20
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/spf13/cobra v1.8.1
Expand Down Expand Up @@ -58,7 +58,6 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/errors v0.22.0 // indirect
github.com/go-openapi/strfmt v0.23.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -73,7 +72,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kopoli/go-terminal-size v0.0.0-20170219200355-5c97524c8b54 // indirect
github.com/kucherenkovova/safegroup v1.0.2 // indirect
github.com/labstack/echo/v4 v4.12.0 // indirect
github.com/labstack/echo/v4 v4.13.3 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/lithammer/shortuuid/v3 v3.0.7 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
Expand Down Expand Up @@ -125,7 +124,7 @@ require (
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/time v0.8.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit fe9f77a

Please sign in to comment.