Skip to content

6 rows with limit 6 and 0 rows with limit 5 #22

@ygmarchi

Description

@ygmarchi

Hello,

I'm facing the weird situation that this query generated by korvus returns 6 rows with limit 6 and 0 rows with limit 5.

with "pipeline" ("schema") as (
select
    "schema"
from
    "ipsilon"."pipelines"
where
    "name" = 'intfloat/multilingual-e5-base') ,
"text_embedding" ("embedding") as (
select
    pgml.embed(transformer => (
    select
        schema #>> '{text,semantic_search,model}'
    from
        pipeline),
    text => 'Come posso chiedere un rimborso spese?',
    kwargs => '{"prompt": "Represent this sentence for searching relevant passages: "}') as "embedding")
select * from (    
select
        1 as score,
        "documents"."id",
        "chunks"."chunk",
        "documents"."document"
    from
        "ipsilon_intfloat/multilingual-e5-base"."text_embeddings" as "embeddings"
    inner join "ipsilon_intfloat/multilingual-e5-base"."text_chunks" as "chunks" on
        "chunks"."id" = "embeddings"."chunk_id"
    inner join "ipsilon"."documents" as "documents" on
        "documents"."id" = "chunks"."document_id"
    inner join "ipsilon_intfloat/multilingual-e5-base"."text_tsvectors" as "tsvectors" on
        "tsvectors"."chunk_id" = "embeddings"."chunk_id"
    where
        tsvectors.ts @@ plainto_tsquery((
        select
            oid
        from
            pg_ts_config
        where
            cfgname = (
            select
                schema #>> '{text,full_text_search,configuration}'
            from
                pipeline)),
        'rimborso spese')
    order by
        embeddings.embedding <=> (
        select
            embedding
        from
            "text_embedding")::vector asc
) s            
limit 6```

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