mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Update block docs for: code_extraction_block.md
This commit is contained in:
37
docs/content/platform/blocks/update/code_extraction_block.md
Normal file
37
docs/content/platform/blocks/update/code_extraction_block.md
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
## Code Extraction Block
|
||||
|
||||
### What it is
|
||||
A specialized tool that identifies and extracts code snippets written in different programming languages from a given text.
|
||||
|
||||
### What it does
|
||||
This block scans through text content (such as AI responses or documentation) and automatically separates out code snippets based on their programming language, organizing them into distinct categories while preserving the remaining non-code text.
|
||||
|
||||
### How it works
|
||||
The block searches for code snippets that are enclosed in triple backticks (```) with a language identifier. It recognizes multiple programming languages and their common aliases (like "js" for JavaScript or "py" for Python), extracts the code, and organizes it by language type. Any text that isn't code is preserved separately.
|
||||
|
||||
### Inputs
|
||||
- Text: The input text that contains code blocks to be extracted. This could be an AI response, documentation, or any text that includes code snippets marked with language identifiers.
|
||||
|
||||
### Outputs
|
||||
- HTML: Extracted HTML markup code
|
||||
- CSS: Extracted CSS styling code
|
||||
- JavaScript: Extracted JavaScript code
|
||||
- Python: Extracted Python code
|
||||
- SQL: Extracted SQL queries
|
||||
- Java: Extracted Java code
|
||||
- C++: Extracted C++ code
|
||||
- C#: Extracted C# code
|
||||
- JSON: Extracted JSON data
|
||||
- Bash: Extracted Bash/Shell scripts
|
||||
- PHP: Extracted PHP code
|
||||
- Ruby: Extracted Ruby code
|
||||
- YAML: Extracted YAML configurations
|
||||
- Markdown: Extracted Markdown content
|
||||
- TypeScript: Extracted TypeScript code
|
||||
- XML: Extracted XML markup
|
||||
- Remaining Text: Any non-code text that was in the original input
|
||||
|
||||
### Possible use case
|
||||
A developer is working with an AI assistant that provides responses containing multiple code examples in different programming languages. Instead of manually copying and separating the code snippets, they can use this block to automatically extract and organize all code samples by language, making it easy to implement the relevant parts in their project. The block would separate the Python code, HTML markup, and CSS styling into distinct outputs while preserving any explanatory text in the "remaining text" output.
|
||||
|
||||
Reference in New Issue
Block a user