PocketFlow-Tutorial-Codebase-Knowledge icon indicating copy to clipboard operation
PocketFlow-Tutorial-Codebase-Knowledge copied to clipboard

prompt is too long?

Open cipherome-minkim opened this issue 1 year ago • 3 comments

I'm trying to use claude-sonnet-4-20250514 with the following settings in call_llm.py

...
response = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=16000,
        thinking={
            "type": "enabled",
            "budget_tokens": 10000
        },
        messages=[
            {"role": "user", "content": prompt}
        ]
    )
...

after a bit of "Identifying abstractions using LLM..."

I get a exception stack dump with the following error:

anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'prompt is too long: 211230 tokens > 200000 maximum'}}

211,230 tokens seems like alot... I don't think I understand how the max_tokens in the settings are being used in the prompt composing.

Can anyone help me understand what parameters I need to tweak to get it to process a repo. I'm not working a huge repo (just under 500 files fetched)

This is how I'm running the pipeline.

python main.py --dir /tmp/test-repo --include "*.java" "*.kt" --exclude ".github/*" -s 50000

Thanks in advance.

cipherome-minkim avatar May 23 '25 18:05 cipherome-minkim

Claude models don't have large enough context (200K). Try gemini 2.5. It has 1M context.

zachary62 avatar May 23 '25 18:05 zachary62

Claude models don't have large enough context (200K). Try gemini 2.5. It has 1M context.

"Currently, is it only possible to use Gemini 2.5 for large projects?" "Are there any other solutions?"

sad192 avatar May 28 '25 10:05 sad192

Claude models don't have large enough context (200K). Try gemini 2.5. It has 1M context.

"Currently, is it only possible to use Gemini 2.5 for large projects?" "Are there any other solutions?"

Another way is to modify the current flow by asking the LLMs to first choose a subset of most important files that fit in the context window

zachary62 avatar May 29 '25 05:05 zachary62