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

Add --xml flag to structure output for Claude's long context window #15

Open
lexh opened this issue Apr 24, 2024 · 0 comments · May be fixed by #16
Open

Add --xml flag to structure output for Claude's long context window #15

lexh opened this issue Apr 24, 2024 · 0 comments · May be fixed by #16

Comments

@lexh
Copy link

lexh commented Apr 24, 2024

Add --xml flag to structure output for Claude's long context window

Background

Anthropic has provided specific guidelines for optimally structuring prompts to take advantage of Claude's extended context window (up to 200K tokens for Claude 3 models).

In particular, they recommend wrapping long input documents in XML tags to clearly delineate the boundaries between the documents and the rest of the prompt. This allows Claude to more accurately process the information.

Proposal

To better support using files-to-prompt output with Claude, a new --xml flag should be added. When this flag is set, the tool should structure its output like this:

Here are some documents for you to reference for your task:

<documents>
<document path="path/to/file1.txt">
Contents of file1.txt
</document>

<document path="path/to/file2.txt">
Contents of file2.txt
</document>
</documents>

The <documents> and <document> tags clearly separate the file contents from any additional prompt text that may be provided after.

Additional Considerations

  • The --xml flag should be optional, preserving the default untagged output for other use as needed
  • Documentation and usage examples should be updated to cover the new --xml option
  • The XML tag output feature should be covered by new unit tests
lexh pushed a commit to lexh/files-to-prompt that referenced this issue Apr 24, 2024
@lexh lexh linked a pull request Apr 24, 2024 that will close this issue
lexh added a commit to lexh/files-to-prompt that referenced this issue Apr 24, 2024
lexh added a commit to lexh/files-to-prompt that referenced this issue Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant