Skip to content

test: cover Anthropic prompt-caching paths in response_api - #40

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789678043-test-anthropic-prompt-caching
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789678043-test-anthropic-prompt-caching

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Closes a code-scan coverage gap: nothing in tests/ exercised the Anthropic prompt-caching flags, so apply_cache_breakpoints, mark_all_previous_msg_for_caching, and the cache_control injections in ClaudeResponseModel._call_api were entirely untested.

Tests only; no production code changed. Each Claude test patches client.messages.create and asserts on the captured api_params:

  • default payload puts no cache_control on tools or message content
  • cache_tool_definition=True marks tools[-1] only
  • cache_complete_prompt=True marks messages[-1]["content"][-1] only
  • use_cache_breakpoints=True marks exactly the builders whose mark_all_previous_msg_for_caching() was called
  • pins current behavior for the risky index: a marked message with empty content raises IndexError (documents the crash rather than silently accepting it)
  • builder-level: Anthropic builder sets _cache_breakpoint, both OpenAI builders no-op, base MessageBuilder raises NotImplementedError

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/71d38fe07b4749a09f2de8349f9bcd7c
Open in Devin Desktop: https://app.devin.ai/desktop/session/71d38fe07b4749a09f2de8349f9bcd7c?variant=devin

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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 this pull request may close these issues.

0 participants