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

Feat: General File Reader Tool #398

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
tools:
sendgrid:
reference: ./sendgrid
file-reader:
reference: ./knowledge/file-reader.gpt
file-summarizer:
reference: ./file-summarizer
database:
Expand Down
26 changes: 26 additions & 0 deletions knowledge/file-reader.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Name: File Reader
Description: This tool reads any supported type of text-heavy documents(PDF, DOCX, PPTX, HTML) in the workspace, converts its content to markdown format. The parsed content will be send back to LLM or saved to a workspace file if output_file is provided.
Params: Input: The workspace file to be read. This file can be of any supported text-heavy documents. Supported extensions: .pdf, .docx, .pptx, .html.
Params: Output: (Optional) Default to empty. If provided, the parsed content will be saved to this file. The file name must have a ".md" extension.
Params: know_load_metadata: Comma-delimited key=value pairs to be added to the metadata of the loaded document.
Credential: github.com/gptscript-ai/credentials/model-provider
Credential: ../existing-credential as knowledge
Metadata: noUserAuth: sys.model.provider.credential,knowledge

#!/bin/bash

if [ -z "$OUTPUT" ]; then
# write to stdout by default
${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool load --format=markdown --flows-file=blueprint:obot --flow=obotload "ws://files/${INPUT}" -
else
${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool load --format=markdown --flows-file=blueprint:obot --flow=obotload "ws://files/${INPUT}" "ws://files/${OUTPUT}"
fi


---
!metadata:*:icon
https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/duotone/file-text-duotone.svg

---
!metadata:*:category
Utilities
Loading