Skip to content

Commit

Permalink
dashboard: support chat with LLM (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored Feb 9, 2025
1 parent e2da281 commit d5c570d
Show file tree
Hide file tree
Showing 12 changed files with 561 additions and 431 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.23.x
- uses: actions/checkout@v2
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
Expand Down
45 changes: 30 additions & 15 deletions common/mock/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package mock

import (
"bytes"
"encoding/json"
"fmt"
"github.com/emicklei/go-restful/v3"
"github.com/sashabaranov/go-openai"
Expand All @@ -28,16 +30,15 @@ type OpenAIServer struct {
authToken string
ready chan struct{}

mockChatCompletion string
mockEmbeddings []float32
mockEmbeddings []float32
}

func NewOpenAIServer() *OpenAIServer {
s := &OpenAIServer{}
ws := new(restful.WebService)
ws.Path("/v1").
Consumes(restful.MIME_XML, restful.MIME_JSON).
Produces(restful.MIME_JSON, restful.MIME_XML)
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON, "text/event-stream")
ws.Route(ws.POST("chat/completions").
Reads(openai.ChatCompletionRequest{}).
Writes(openai.ChatCompletionResponse{}).
Expand Down Expand Up @@ -80,10 +81,6 @@ func (s *OpenAIServer) Close() error {
return s.httpServer.Close()
}

func (s *OpenAIServer) ChatCompletion(mock string) {
s.mockChatCompletion = mock
}

func (s *OpenAIServer) Embeddings(embeddings []float32) {
s.mockEmbeddings = embeddings
}
Expand All @@ -95,13 +92,31 @@ func (s *OpenAIServer) chatCompletion(req *restful.Request, resp *restful.Respon
_ = resp.WriteError(http.StatusBadRequest, err)
return
}
_ = resp.WriteEntity(openai.ChatCompletionResponse{
Choices: []openai.ChatCompletionChoice{{
Message: openai.ChatCompletionMessage{
Content: s.mockChatCompletion,
},
}},
})
if r.Stream {
content := r.Messages[0].Content
for i := 0; i < len(content); i += 8 {
buf := bytes.NewBuffer(nil)
buf.WriteString("data: ")
encoder := json.NewEncoder(buf)
_ = encoder.Encode(openai.ChatCompletionStreamResponse{
Choices: []openai.ChatCompletionStreamChoice{{
Delta: openai.ChatCompletionStreamChoiceDelta{
Content: content[i:min(i+8, len(content))],
},
}},
})
buf.WriteString("\n")
_, _ = resp.Write(buf.Bytes())
}
} else {
_ = resp.WriteEntity(openai.ChatCompletionResponse{
Choices: []openai.ChatCompletionChoice{{
Message: openai.ChatCompletionMessage{
Content: r.Messages[0].Content,
},
}},
})
}
}

func (s *OpenAIServer) embeddings(req *restful.Request, resp *restful.Response) {
Expand Down
38 changes: 36 additions & 2 deletions common/mock/openai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ package mock

import (
"context"
"github.com/juju/errors"
"github.com/sashabaranov/go-openai"
"github.com/stretchr/testify/suite"
"io"
"strings"
"testing"
)

Expand Down Expand Up @@ -45,7 +48,6 @@ func (suite *OpenAITestSuite) TearDownSuite() {
}

func (suite *OpenAITestSuite) TestChatCompletion() {
suite.server.ChatCompletion("World")
resp, err := suite.client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Expand All @@ -59,7 +61,39 @@ func (suite *OpenAITestSuite) TestChatCompletion() {
},
)
suite.NoError(err)
suite.Equal("World", resp.Choices[0].Message.Content)
suite.Equal("Hello", resp.Choices[0].Message.Content)
}

func (suite *OpenAITestSuite) TestChatCompletionStream() {
content := "In my younger and more vulnerable years my father gave me some advice that I've been turning over in" +
" my mind ever since. Whenever you feel like criticizing anyone, he told me, just remember that all the " +
"people in this world haven't had the advantages that you've had."
stream, err := suite.client.CreateChatCompletionStream(
context.Background(),
openai.ChatCompletionRequest{
Model: "qwen2.5",
Messages: []openai.ChatCompletionMessage{
{
Role: openai.ChatMessageRoleUser,
Content: content,
},
},
Stream: true,
},
)
suite.NoError(err)
defer stream.Close()
var buffer strings.Builder
for {
var resp openai.ChatCompletionStreamResponse
resp, err = stream.Recv()
if errors.Is(err, io.EOF) {
suite.Equal(content, buffer.String())
return
}
suite.NoError(err)
buffer.WriteString(resp.Choices[0].Delta.Content)
}
}

func (suite *OpenAITestSuite) TestEmbeddings() {
Expand Down
11 changes: 10 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Config struct {
Tracing TracingConfig `mapstructure:"tracing"`
Experimental ExperimentalConfig `mapstructure:"experimental"`
OIDC OIDCConfig `mapstructure:"oidc"`
OpenAI OpenAIConfig `mapstructure:"openai"`
}

// DatabaseConfig is the configuration for the database.
Expand Down Expand Up @@ -149,8 +150,9 @@ type NeighborsConfig struct {

type ItemToItemConfig struct {
Name string `mapstructure:"name" json:"name"`
Type string `mapstructure:"type" json:"type" validate:"oneof=embedding tags users"`
Type string `mapstructure:"type" json:"type" validate:"oneof=embedding tags users llm"`
Column string `mapstructure:"column" json:"column" validate:"item_expr"`
Prompt string `mapstructure:"prompt" json:"prompt"`
}

func (config *ItemToItemConfig) Hash() string {
Expand Down Expand Up @@ -214,6 +216,13 @@ type OIDCConfig struct {
RedirectURL string `mapstructure:"redirect_url" validate:"omitempty,endswith=/callback/oauth2"`
}

type OpenAIConfig struct {
BaseURL string `mapstructure:"base_url"`
AuthToken string `mapstructure:"auth_token"`
ChatCompletionModel string `mapstructure:"chat_completion_model"`
EmbeddingsModel string `mapstructure:"embeddings_model"`
}

func GetDefaultConfig() *Config {
return &Config{
Database: DatabaseConfig{
Expand Down
14 changes: 14 additions & 0 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,17 @@ client_secret = ""
# Gorse dashboard URL and "/callback/oauth2". For example, if the Gorse dashboard URL is
# http://localhost:8088, the redirect URL should be: http://localhost:8088/callback/oauth2
redirect_url = ""

[openai]

# Base URL of OpenAI API.
base_url = "http://localhost:11434/v1"

# API key of OpenAI API.
auth_token = "ollama"

# Name of chat completion model.
chat_completion_model = "qwen2.5"

# Name of embeddings model.
embeddings_model = "mxbai-embed-large"
5 changes: 5 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func TestUnmarshal(t *testing.T) {
assert.Equal(t, "client_id", config.OIDC.ClientID)
assert.Equal(t, "client_secret", config.OIDC.ClientSecret)
assert.Equal(t, "http://localhost:8088/callback/oauth2", config.OIDC.RedirectURL)
// [openai]
assert.Equal(t, "http://localhost:11434/v1", config.OpenAI.BaseURL)
assert.Equal(t, "ollama", config.OpenAI.AuthToken)
assert.Equal(t, "qwen2.5", config.OpenAI.ChatCompletionModel)
assert.Equal(t, "mxbai-embed-large", config.OpenAI.EmbeddingsModel)
})
}
}
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/zhenghaoz/gorse

go 1.23.5

toolchain go1.23.6
go 1.23.6

require (
github.com/XSAM/otelsql v0.35.0
Expand All @@ -24,7 +22,7 @@ require (
github.com/go-viper/mapstructure/v2 v2.2.1
github.com/google/uuid v1.6.0
github.com/gorilla/securecookie v1.1.1
github.com/gorse-io/dashboard v0.0.0-20250206135652-01a4864452d9
github.com/gorse-io/dashboard v0.0.0-20250209091713-a70341e78d48
github.com/gorse-io/gorse-go v0.5.0-alpha.1
github.com/haxii/go-swagger-ui v0.0.0-20210203093335-a63a6bbde946
github.com/jaswdr/faker v1.16.0
Expand All @@ -37,6 +35,7 @@ require (
github.com/madflojo/testcerts v1.3.0
github.com/mailru/go-clickhouse/v2 v2.0.1-0.20221121001540-b259988ad8e5
github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/nikolalohinski/gonja/v2 v2.3.3
github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
Expand Down Expand Up @@ -66,7 +65,7 @@ require (
go.opentelemetry.io/otel/trace v1.31.0
go.uber.org/atomic v1.10.0
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/oauth2 v0.22.0
google.golang.org/grpc v1.67.1
google.golang.org/grpc/security/advancedtls v1.0.0
Expand Down Expand Up @@ -96,7 +95,7 @@ require (
github.com/chewxy/hm v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand All @@ -111,6 +110,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v2.0.6+incompatible // indirect
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -167,13 +167,13 @@ require (
go.uber.org/multierr v1.10.0 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
Expand Down
24 changes: 13 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17
github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/emicklei/go-restful-openapi/v2 v2.9.0 h1:djsWqjhI0EVYfkLCCX6jZxUkLmYUq2q9tt09ZbixfyE=
github.com/emicklei/go-restful-openapi/v2 v2.9.0/go.mod h1:VKNgZyYviM1hnyrjD9RDzP2RuE94xTXxV+u6MGN4v4k=
github.com/emicklei/go-restful/v3 v3.7.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
Expand Down Expand Up @@ -286,8 +287,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA=
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand All @@ -303,8 +304,8 @@ github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyC
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorse-io/clickhouse v0.3.3-0.20220715124633-688011a495bb h1:z/oOWE+Vy0PLcwIulZmIug4FtmvE3dJ1YOGprLeHwwY=
github.com/gorse-io/clickhouse v0.3.3-0.20220715124633-688011a495bb/go.mod h1:iILWzbul8U+gsf4kqbheF2QzBmdvVp63mloGGK8emDI=
github.com/gorse-io/dashboard v0.0.0-20250206135652-01a4864452d9 h1:Eh7AzLEERcKDk/CczD+eUHKhNg/X9Bob+47JIcU7/3M=
github.com/gorse-io/dashboard v0.0.0-20250206135652-01a4864452d9/go.mod h1:lv2bu311bjIJeRfY+6hiIaw20M6fLxT4ma9Ye+bpwGY=
github.com/gorse-io/dashboard v0.0.0-20250209091713-a70341e78d48 h1:kfCK07ae/+NvxlcPqh0SpaXxkDlceqSmamsX7t/E4+w=
github.com/gorse-io/dashboard v0.0.0-20250209091713-a70341e78d48/go.mod h1:lv2bu311bjIJeRfY+6hiIaw20M6fLxT4ma9Ye+bpwGY=
github.com/gorse-io/gorgonia v0.0.0-20230817132253-6dd1dbf95849 h1:Hwywr6NxzYeZYn35KwOsw7j8ZiMT60TBzpbn1MbEido=
github.com/gorse-io/gorgonia v0.0.0-20230817132253-6dd1dbf95849/go.mod h1:TtVGAt7ENNmgBnC0JA68CAjIDCEtcqaRHvnkAWJ/Fu0=
github.com/gorse-io/gorse-go v0.5.0-alpha.1 h1:QBWKGAbSKNAWnieXVIdQiE0lLGvKXfFFAFPOQEkPW/E=
Expand Down Expand Up @@ -487,6 +488,7 @@ github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nikolalohinski/gonja/v2 v2.3.3/go.mod h1:8KC3RlefxnOaY5P4rH5erdwV0/owS83U615cSnDLYFs=
github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A=
github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM=
github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY=
Expand Down Expand Up @@ -737,8 +739,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
Expand Down Expand Up @@ -774,8 +776,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -986,8 +988,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
2 changes: 1 addition & 1 deletion logics/item_to_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type embeddingItemToItem struct {
dimension int
}

func newEmbeddingItemToItem(cfg config.ItemToItemConfig, n int, timestamp time.Time) (ItemToItem, error) {
func newEmbeddingItemToItem(cfg config.ItemToItemConfig, n int, timestamp time.Time) (*embeddingItemToItem, error) {
// Compile column expression
columnFunc, err := expr.Compile(cfg.Column, expr.Env(map[string]any{
"item": data.Item{},
Expand Down
Loading

0 comments on commit d5c570d

Please sign in to comment.