Module: Instructor
- Defined in:
- lib/instructor.rb,
lib/instructor/mode.rb,
lib/instructor/version.rb,
lib/instructor/openai/patch.rb,
lib/instructor/openai/response.rb
Overview
The Instructor module provides functionality for interacting with OpenAI’s chat API.
Defined Under Namespace
Modules: Mode, OpenAI Classes: Error, ValidationError
Constant Summary collapse
- VERSION =
'0.1.3'
Class Method Summary collapse
- .mode ⇒ Object
-
.patch(openai_client, mode: Instructor::Mode::TOOLS.function) ⇒ OpenAI::Client
Patches the OpenAI client to add the following functionality: - Retries on exceptions - Accepts and validates a response model - Accepts a validation_context argument.
Class Method Details
.mode ⇒ Object
21 22 23 |
# File 'lib/instructor.rb', line 21 def self.mode @mode end |
.patch(openai_client, mode: Instructor::Mode::TOOLS.function) ⇒ OpenAI::Client
Patches the OpenAI client to add the following functionality:
-
Retries on exceptions
-
Accepts and validates a response model
-
Accepts a validation_context argument
33 34 35 36 |
# File 'lib/instructor.rb', line 33 def self.patch(openai_client, mode: Instructor::Mode::TOOLS.function) @mode = mode openai_client.prepend(Instructor::OpenAI::Patch) end |