[Python] Privategpt listing ingested document filenames

Discussão em 'Python' iniciado por Stack, Maio 2, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to LLMs and need to extract the file names of files that have been already ingested into PrivateGPT that the system uses to answer questions.

    I can list the doc_ids using :

    from pgpt_python.client import PrivateGPTApi

    client = PrivateGPTApi(base_url="http://localhost:8001")

    # Health
    print(client.health.health())

    # List ingested docs
    for doc in client.ingestion.list_ingested().data:
    print(doc.doc_id)


    which gives an output of :

    e019a7be-3b0d-45b6-a1f6-195735a20725
    8d59d127-3432-47e4-8beb-5465fdb1e72d
    8df9068b-fa3c-42b5-b987-0bee211bce0a
    b56fb71a-fd3e-4cd9-9728-3b70ff045162
    dbebc4a6-29af-4ac9-b311-0a53b74cbb4f
    e9f28c23-5d08-4660-aa4c-8f2389901583
    68da2416-57ff-45c7-9af6-dc70175d1a15
    f6880d64-434c-4527-8705-df67f19a6dfc
    84e66ed4-aa0f-4058-a1b9-19d7a89d8d95
    etc


    However haven't been able to find the mechanism to list the current 5 files that the system has ingested.

    Any help appreciated.

    Continue reading...

Compartilhe esta Página