langchain-ai/langchain-google
Auf GitHub ansehenEnabling 1 Million token context window for Claude 4.5
Open
#1.234 geöffnet am 8. Okt. 2025
anthropic-vertexhelp wantedvertexai
Repository-Metriken
- Stars
- (392 Stars)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
As documented here, we can enable enlarged context window by using a beta header. The way I understand to do this from here with init_chat_model is:
init_chat_model(model='claude-sonnet-4-5@20250929', {'model_provider': 'google_anthropic_vertex', 'additional_headers': {'anthropic-beta': 'context-1m-2025-08-07'}})
But I always get this error when I try to submit something > 200k tokens:
Error code: 413 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'Prompt is too long'}, 'request_id': 'req_vrtx_011CTucweqqUPTN2rooW5KYk'}
Should this work through this library? Maybe there's a different way? I'd be happy to document this if I can get some clarification