Skip to content

OpenAI "text-embedding-3-large" model: vector's dimensions must be <= [2048]; got 3072 #14

@amotl

Description

@amotl

Problem

When trying to store text embeddings using OpenAI's text-embedding-3-large into CrateDB, LangChain trips.

OpenAIEmbeddings(model="text-embedding-3-large")
sqlalchemy.exc.ProgrammingError: (crate.client.exceptions.ProgrammingError)
SQLParseException[Field [6] vector's dimensions must be <= [2048]; got 3072]
[SQL: INSERT INTO langchain_embedding (id, collection_id, embedding, document, cmetadata) VALUES (?, ?, ?, ?, ?) ON CONFLICT (id) DO UPDATE SET embedding = excluded.embedding, document = excluded.document, cmetadata = excluded.cmetadata]

Details

Processing the SQL DDL statement using FLOAT_VECTOR(3072) succeeds.

CREATE TABLE langchain_embedding (
  id STRING NOT NULL,
  collection_id STRING,
  embedding FLOAT_VECTOR(3072),
  document STRING,
  cmetadata OBJECT,
  PRIMARY KEY (id)
)

The error happens when processing the INSERT statement.

INSERT INTO langchain_embedding (id, collection_id, embedding, document, cmetadata)
VALUES (?, ?, ?, ?, ?) ON CONFLICT (id) DO
UPDATE
SET embedding = excluded.embedding,
    document = excluded.document,
    cmetadata = excluded.cmetadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions