-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from sergiobayona/1-implement-multiple-modes
1 implement multiple modes
- Loading branch information
Showing
16 changed files
with
223 additions
and
203 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'ostruct' | ||
|
||
module Instructor | ||
# This module defines constants related to different modes of operation. | ||
# It provides options for tool behavior, function types, and JSON modes. | ||
# Currently supported modes are: | ||
# - tools: select between function, auto, required, and none. | ||
# more modes will be added in the near future. | ||
module Mode | ||
tool_options = %w[function auto required none].index_by(&:itself) | ||
TOOL_BEHAVIOR = OpenStruct.new(tool_options) | ||
|
||
FUNCTIONS = 'function_call' | ||
PARALLEL_TOOLS = 'parallel_tool_call' | ||
TOOLS = TOOL_BEHAVIOR | ||
JSON = 'json_mode' | ||
MD_JSON = 'markdown_json_mode' | ||
JSON_SCHEMA = 'json_schema_mode' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Instructor | ||
VERSION = '0.1.1' | ||
VERSION = '0.1.3' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe Instructor, '.class' do | ||
it 'returns the default mode after patching' do | ||
described_class.patch(OpenAI::Client) | ||
expect(described_class.mode).to eq(Instructor::Mode::TOOLS.function) | ||
end | ||
|
||
it 'changes the the mode' do | ||
described_class.patch(OpenAI::Client, mode: Instructor::Mode::TOOLS.auto) | ||
expect(described_class.mode).to eq(Instructor::Mode::TOOLS.auto) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.