Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .ci/integration.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ steps:
- "SINGLESTORE_USER=$_SINGLESTORE_USER"
- "SINGLESTORE_DATABASE=$_SINGLESTORE_DATABASE"
- "SERVICE_ACCOUNT_EMAIL=$SERVICE_ACCOUNT_EMAIL"
secretEnv: ["SINGLESTORE_PASSWORD", "SINGLESTORE_HOST", "CLIENT_ID"]
secretEnv: ["SINGLESTORE_PASSWORD", "SINGLESTORE_HOST", "CLIENT_ID", "API_KEY"]
volumes:
- name: "go"
path: "/gopath"
Expand All @@ -1351,7 +1351,9 @@ steps:
.ci/test_with_coverage.sh \
"SingleStore" \
singlestore \
singlestore
singlestore \
"" \
"API_KEY"
else
echo "No relevant changes for SingleStore. Skipping shard."
exit 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para
}

func (t Tool) EmbedParams(ctx context.Context, paramValues parameters.ParamValues, embeddingModelsMap map[string]embeddingmodels.EmbeddingModel) (parameters.ParamValues, error) {
return parameters.EmbedParams(ctx, t.Parameters, paramValues, embeddingModelsMap, nil)
return parameters.EmbedParams(ctx, t.Parameters, paramValues, embeddingModelsMap, embeddingmodels.FormatVectorForPgvector)
}

func (t Tool) Manifest() tools.Manifest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para
}

func (t Tool) EmbedParams(ctx context.Context, paramValues parameters.ParamValues, embeddingModelsMap map[string]embeddingmodels.EmbeddingModel) (parameters.ParamValues, error) {
return parameters.EmbedParams(ctx, t.AllParams, paramValues, embeddingModelsMap, nil)
return parameters.EmbedParams(ctx, t.AllParams, paramValues, embeddingModelsMap, embeddingmodels.FormatVectorForPgvector)
}

func (t Tool) Manifest() tools.Manifest {
Expand Down
22 changes: 22 additions & 0 deletions tests/singlestore/singlestore_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@
tmplSelectCombined, tmplSelectFilterCombined := getSingleStoreTmplToolStatement()
toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SingleStoreToolType, tmplSelectCombined, tmplSelectFilterCombined, "")

insertStmt := `INSERT INTO senseai_docs (content, embedding) VALUES (?, ?)`
searchStmt := `
SELECT content
FROM senseai_docs
ORDER BY DOT_PRODUCT(embedding, JSON_ARRAY_UNPACK(?)) DESC
LIMIT 1`
toolsFile = tests.AddSemanticSearchConfig(t, toolsFile, SingleStoreToolType, insertStmt, searchStmt)

cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...)
if err != nil {
t.Fatalf("command initialization returned an error: %s", err)
Expand All @@ -235,4 +243,18 @@
tests.RunMCPToolCallMethod(t, mcpMyFailToolWant, mcpSelect1Want)
tests.RunExecuteSqlToolInvokeTest(t, createTableStatement, select1Want)
tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam)

// Create table for semantic search
_, err = pool.ExecContext(ctx, "CREATE TABLE IF NOT EXISTS senseai_docs (id INT AUTO_INCREMENT PRIMARY KEY, content TEXT, embedding JSON);")
if err != nil {
t.Fatalf("unable to create semantic search table: %s", err)
}
defer func() {
pool.ExecContext(ctx, "DROP TABLE IF EXISTS senseai_docs;")

Check failure on line 253 in tests/singlestore/singlestore_integration_test.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `pool.ExecContext` is not checked (errcheck)
}()

// Semantic search tests
semanticInsertWant := `[{"":""}]`
semanticSearchWant := `[{"content":"The quick brown fox jumps over the lazy dog"}]`
tests.RunSemanticSearchToolInvokeTest(t, semanticInsertWant, semanticInsertWant, semanticSearchWant)
}
Loading