korvus icon indicating copy to clipboard operation
korvus copied to clipboard

Exception: error returned from database: function pgml.transform(task => jsonb, inputs => jsonb[], args => jsonb) does not exist

Open PragnakalpDev29 opened this issue 1 year ago • 1 comments

async def main(): collection = Collection("test_collection")

pipeline = Pipeline(
    "v3",
    {
        "text": {
            "splitter": {"model": "recursive_character"},
            "semantic_search": {
                "model": "mixedbread-ai/mxbai-embed-large-v1",
            },
            "full_text_search": {"configuration": "english"},
        }
    }
)

await collection.add_pipeline(pipeline)

documents = [
    {"id": "1", "text": "Korvus is incredibly fast and easy to use."},
    {"id": "2", "text": "Tomatoes are incredible on burgers."},
]
await collection.upsert_documents(documents)

results = await collection.rag(
    {
        "CONTEXT": {
            "vector_search": {
                "query": {
                    "fields": {
                        "text": {
                            "query": "Is Korvus fast?",
                            "parameters": {
                                "prompt": "Represent this sentence for searching relevant passages: "
                            },
                        }
                    },
                },
                "document": {"keys": ["id"]},
                "limit": 5,
            },
            "aggregate": {"join": "\n"},
        },
        "chat": {
            "model": "meta-llama/Meta-Llama-3-8B-Instruct",
            "messages": [
                {
                    "role": "system",
                    "content": "You are a friendly and helpful chatbot",
                },
                {
                    "role": "user",
                    "content": "Given the context\n:{CONTEXT}\nAnswer the question: Is Korvus fast?",
                },
            ],
            "max_tokens": 100,
        },
    },
    pipeline,
)

print(results)

Run the asynchronous function

asyncio.run(main()) print("DONE!")

with this code I got Added Pipeline v3, Now Syncing... Done Syncing v3 Upserting Documents... Done Upserting Documents [00:00:01] ████████████████████████████████████████ 2/2 Traceback (most recent call last): File "/media/pkl43150324/Projects/test/Projects/korvus_test/test2.py", line 219, in asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/media/pkl43150324/Projects/test/Projects/korvus_test/test2.py", line 179, in main results = await collection.rag( Exception: error returned from database: function pgml.transform(task => jsonb, inputs => jsonb[], args => jsonb) does not exist

PragnakalpDev29 avatar Sep 12 '24 13:09 PragnakalpDev29

What version of pgml are you using? Can you run \dx in your database and share the output?

SilasMarvin avatar Sep 12 '24 22:09 SilasMarvin

Closing this as it seems to be an isolated issue and most likely has to do with the version of pgml they are running.

SilasMarvin avatar Jan 13 '25 17:01 SilasMarvin