sublayerapp / sublayer

A model-agnostic Ruby Generative AI DSL and framework. Provides base classes for building Generators, Actions, Tasks, and Agents that can be used to build AI powered applications in Ruby.
https://docs.sublayer.com
MIT License
119 stars 2 forks source link

Scaffold for testing Provider API calls with VCR #9

Closed drnic closed 7 months ago

drnic commented 7 months ago

See spec_helper.rb for configuring env vars to be sanitized from vcr cassette yaml files, to prevent leaking secrets.

VCR.configure do |config|
  config.cassette_library_dir = "spec/vcr_cassettes"
  config.hook_into :webmock
  config.filter_sensitive_data("<OPENAI_API_KEY>") { ENV["OPENAI_API_KEY"] }
  config.filter_sensitive_data("<ANTHROPIC_API_KEY>") { ENV["ANTHROPIC_API_KEY"] }
end

Also, Github Actions will need to add these env vars (even if they are dummy values since they are stubbed out by VCR with the above code)

swerner commented 7 months ago

Looks great! Thanks so much for putting this together!