Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: llamaindex-cli unrecognized arguments: - files ./README.md #10315

Closed
fengyunzaidushi opened this issue Jan 28, 2024 · 4 comments
Closed
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@fengyunzaidushi
Copy link

Bug Description

`
(base) ubuntu@ubuntu:/mnt/sda/github/01yue/llama_index$ llamaindex-cli rag - files "./README.md"
usage: llamaindex-cli [-h] {rag,download-llamapack,download-llamadataset} ...
llamaindex-cli: error: unrecognized arguments: - files ./README.md

`

`
(base) ubuntu@ubuntu:/mnt/sda/github/01yue/llama_index$ llamaindex-cli -h
usage: llamaindex-cli [-h] {rag,download-llamapack,download-llamadataset} ...

LlamaIndex CLI tool.

options:
-h, --help show this help message and exit

commands:
{rag,download-llamapack,download-llamadataset}
rag Ask a question to a document / a directory of documents.
download-llamapack Download a llama-pack
download-llamadataset
Download a llama-dataset

`

Version

0.9.39

Steps to Reproduce

llamaindex-cli rag - files "./README.md"

Relevant Logs/Tracbacks

No response

@fengyunzaidushi fengyunzaidushi added bug Something isn't working triage Issue needs to be triaged/prioritized labels Jan 28, 2024
Copy link

dosubot bot commented Jan 28, 2024

🤖

Hey @fengyunzaidushi, good to see you here again! Hope your coding journey is going well.

The error you're encountering is due to incorrect usage of the command. The command you're trying to run is llamaindex-cli rag - files "./README.md". However, the correct format should be llamaindex-cli rag --files "./README.md".

The command-line argument for files is defined as --files in the code, not - files. Here is the relevant code snippet:

parser.add_argument(
    "-f",
    "--files",
    type=str,
    help=(
        "The name of the file or directory you want to ask a question about,"
        'such as "file.pdf".'
    ),
)

So, you should use the command llamaindex-cli rag --files "./README.md" instead. You can find this in the llama_index/command_line/rag.py file.

The correct syntax for using the llamaindex-cli rag command in the LlamaIndex codebase is as follows:

$ llamaindex-cli rag [-h] [-q QUESTION] [-f FILES] [-c] [-v] [--clear]

Here are the options you can use:

  • -h, --help: Show the help message and exit.
  • -q QUESTION, --question QUESTION: The question you want to ask.
  • -f FILES, --files FILES: The name of the file or directory you want to ask a question about, such as "file.pdf".
  • -c, --chat: If flag is present, opens a chat REPL.
  • -v, --verbose: Whether to print out verbose information during execution.
  • --clear: Clears out all currently embedded data.

For example, if you want to ask a question about a specific file, you can use the following command:

$ llamaindex-cli rag --files "./README.md"

And then ask a question like this:

$ llamaindex-cli rag --question "What is LlamaIndex?"

If you want to open a chat interface within your terminal, you can use the following command:

$ llamaindex-cli rag --chat

You can find more information about this in the docs/use_cases/q_and_a/rag_cli.md file.

I hope this helps! If you have any other questions, feel free to ask.

Best,
Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@logan-markewich
Copy link
Collaborator

@fengyunzaidushi as the bot mentioned, please use llamaindex-cli rag --files "./README.md" or llamaindex-cli rag -f "./README.md"

@fengyunzaidushi
Copy link
Author

@fengyunzaidushi as the bot mentioned, please use llamaindex-cli rag --files "./README.md" or llamaindex-cli rag -f "./README.md"

thank you!
https://blog.llamaindex.ai/introducing-the-llamaindex-retrieval-augmented-generation-command-line-tool-a973fa519a41
i followed the articles above,it has some error.
image

@logan-markewich
Copy link
Collaborator

Hmm, seems like a weird formatting error, I'll see if we can fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

2 participants