Skip to content

Support .txt files in LLMFileAnalysisOperator#70431

Open
ColtenOuO wants to merge 1 commit into
apache:mainfrom
ColtenOuO:add-txt-file-analysis-support
Open

Support .txt files in LLMFileAnalysisOperator#70431
ColtenOuO wants to merge 1 commit into
apache:mainfrom
ColtenOuO:add-txt-file-analysis-support

Conversation

@ColtenOuO

Copy link
Copy Markdown
Contributor

Summary

LLMFileAnalysisOperator rejects .txt files with LLMFileAnalysisUnsupportedFormatError, but a file with no extension
at all
(e.g. app) is already accepted and treated as plain text via the "log" fallback in detect_file_format(). The more explicitly-named file was the one that failed.

This also put LLMFileAnalysisOperator out of step with the rest of the provider:

  • DocumentLoaderOperator (this provider's other file-reading operator) already lists .txt as one of its built-in, zero-extra-dependency formats (EXTENSION_BACKEND_MAP: ".txt": "text").
  • Several of the provider's own example DAGs (example_llamaindex_rag.py, example_llamaindex_hook.py, example_langchain_tool_agent.py) ship .txt files as sample input for LLM-related tasks.

Changes

  • Add "txt" to SUPPORTED_FILE_FORMATS, _TEXT_LIKE_FORMATS, and _GZIP_SUPPORTED_FORMATS in utils/file_analysis.py.
  • No parsing/rendering logic changes: the existing generic text-renderingpath (_render_text_like, already used for .log and extension-less files) handles .txt as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant