Skip to content

Conversation

@jkogara
Copy link
Contributor

@jkogara jkogara commented Oct 22, 2025

What this does

  • This PR will add a message to the system prompt of the native anthropic chat provider that instructs it to respond with the given schema if with_schema has called on the chat object.
  • This is a change of behaviour as the schema is currently ignored by the the native anthropic provider.
  • A minor change has also been made to parsing of responses when schema has been set, this was done to facilitate the anthropic models which often return json in code fences.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
    • For provider changes: Re-recorded VCR cassettes with bundle exec rake vcr:record[provider_name]
    • All tests pass: bundle exec rspec
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

@jkogara jkogara force-pushed the jkogara/fix_anthropic_system_prompt branch 2 times, most recently from 887caef to 97240af Compare October 24, 2025 13:48
� This is the commit message crmne#2:

Adds explanation of regexp

Adds explanation of regexp

Remove errant pry require

Updated cassettes

Adds a test and makes sure we are extracting the JSON
@jkogara jkogara force-pushed the jkogara/fix_anthropic_system_prompt branch from 97240af to 5cf6f01 Compare October 26, 2025 19:53
@jkogara jkogara closed this Oct 26, 2025
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.

1 participant