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

workflow api how to upload pdf?No method is found in the document. #9857

Closed
4 tasks done
llama-factory opened this issue Oct 25, 2024 · 2 comments
Closed
4 tasks done
Labels
📚 documentation Improvements or additions to documentation

Comments

@llama-factory
Copy link

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

This issue was closed before it was resolved:#9839

Copy link

dosubot bot commented Oct 25, 2024

I found a similar closed issue titled "workflow api how to upload pdf?" which was referenced by another issue discussing the same topic [1].

To upload a PDF file using the Dify workflow API, you can follow these steps:

  1. Enable File Upload in the "Start" Node: Add a custom file variable in the "Start" node and name it pdf. This allows users to upload a PDF file.

  2. Add a Document Extractor Node: Use a "Document Extractor" node to extract content from the uploaded PDF file. The pdf variable from the "Start" node should be used as the input variable for this node. It converts the PDF content into a string-type output variable.

  3. Process the Extracted Content with an LLM Node: Add an LLM node and use the output variable of the "Document Extractor" node in the system prompt. This allows the LLM to process the extracted text from the PDF file.

  4. Configure the End Node: Select the output variable of the LLM node in the end node to complete the workflow.

Additionally, you can use the following API endpoint to upload files:

  • Create documents from files

    curl --location --request POST 'https://api.dify.ai/v1/datasets/{dataset_id}/document/create_by_file' \
    --header 'Authorization: Bearer {api_key}' \
    --form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \
    --form 'file=@"/path/to/file"'

This endpoint allows you to create a new document through a file based on existing knowledge [1].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 📚 documentation Improvements or additions to documentation label Oct 25, 2024
@crazywoola
Copy link
Member

For questions, please use discussion instead.
For docs, please refer this #9832 later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants