amaiya / onprem

A tool for running on-premises large language models with non-public data
https://amaiya.github.io/onprem
Apache License 2.0
692 stars 35 forks source link

Ingest .csv? #15

Closed VikR0001 closed 1 year ago

VikR0001 commented 1 year ago

Does ingest understand .csv format? I provided a .csv file with:

    from onprem import LLM
    llm = LLM()
    llm.ingest('/Users/mypath/myfile.csv')

I asked a question with this code:

    question = """
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
[my instructions]

### Response:

   """
       answer, docs = llm.ask(question)

I got this message:

ValueError: A vector database has not yet been created. Please call the LLM.ingest method.

Does ingest understand .csv files yet?

amaiya commented 1 year ago

Yes, CSVs are supported and work as expected. Your error is occurring because the ingest method accepts a folder of one or more files (not the path to a single file).

Try this and it should work:

llm.ingest('/Users/mypath/folder_with_csv/mfile.csv`)

I have added a check to ensure that the argument to ingest is a folder not a file.

You should also be careful to ensure the input you supply conforms to what the model and use case expects and look at the examples in the documentation. For example, the ask method expects a question, not a prompt like the one you're displaying.