[Python] Can't get UUID from similarity search Weaviate

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I tried to retrieve documents with similar content to later modify them, but when it came to updating, I realized I couldn't get the ID to update these documents.

    Here’s the function I was using to retrieve documents:

    def retrieve(text):
    """Retrieve information related to a query."""
    retrieved_docs = db.similarity_search(text, k=3)
    return retrieved_docs


    This is how the document structure looks when printed

    Document(metadata={'projectName': ''}, page_content="")


    And in Weaviate:

    {
    "uuid": "",
    "metadata": {
    "creationTime": ""
    },
    "properties": {
    "projectName": "",
    "text": ""
    },
    "vectors": {
    "default": []}}


    And here’s the db configuration, don't know, maybe it helps:

    db = WeaviateVectorStore(
    client=client,
    index_name="Cases",
    embedding=embedding_model,
    text_key="text"
    )


    I haven't found any information about a similar case, everywhere people are interacting with existing uuid. How to get uuid? Or maybe there’s another way to achieve this? For example, saving information as new each time, but will this compromise accuracy over time?

    I’d appreciate your response!

    Continue reading...

Compartilhe esta Página