Skip to content

Commit

Permalink
set defaultEmbeddingDims if MigrateEmbeddingDims dimensions is 0 (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalef authored Nov 1, 2023
1 parent 5dc5082 commit 88d7882
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/store/postgres/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"github.com/uptrace/bun"
)

const defaultEmbeddingDims = 1536

var maxOpenConns = 4 * runtime.GOMAXPROCS(0)

type SessionSchema struct {
Expand Down Expand Up @@ -603,6 +605,11 @@ func MigrateEmbeddingDims(
tableName string,
dimensions int,
) error {
// we may be missing a config key, so use the default dimensions if none are provided
if dimensions == 0 {
dimensions = defaultEmbeddingDims
}

tx, err := db.BeginTx(ctx, nil)
if err != nil {
return fmt.Errorf("MigrateEmbeddingDims error starting transaction: %w", err)
Expand Down

0 comments on commit 88d7882

Please sign in to comment.