├── .envrc ├── .gitignore ├── .rubocop.yml ├── .yardopts ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── SCRATCHPAD.md ├── devbox.json ├── docs ├── anthropic-usage.md ├── how-a-request-works.md ├── openai-usage.md ├── prompt-completion-middleware.md └── streaming-usage.md ├── examples ├── anthropic │ └── cookbook │ │ ├── COOKBOOK-LICENSE │ │ ├── README.md │ │ └── patterns │ │ └── agents │ │ ├── README.md │ │ ├── basic_workflows.ipynb │ │ ├── evaluator_optimizer.ipynb │ │ └── orchestrator_workers.ipynb └── notebook.rb ├── instruct.gemspec ├── lib ├── instruct.rb └── instruct │ ├── compile_erb.rb │ ├── env.rb │ ├── error.rb │ ├── gen │ ├── completion_request.rb │ ├── completion_response.rb │ ├── gen.rb │ └── generate_completion.rb │ ├── helpers │ ├── erb_helper.rb │ ├── gen_helper.rb │ ├── helpers.rb │ ├── model_helper.rb │ ├── monkeypatches.rb │ └── refinements.rb │ ├── llms │ ├── anthropic │ │ ├── completion_model.rb │ │ ├── messages_completion_response.rb │ │ └── middleware.rb │ ├── gemini │ │ ├── chat_completion_response.rb │ │ ├── completion_model.rb │ │ └── middleware.rb │ └── openai │ │ ├── chat_completion_response.rb │ │ ├── completion_model.rb │ │ ├── completion_response.rb │ │ └── middleware.rb │ ├── middleware │ ├── chat_completion_middleware.rb │ └── chomp_middleware.rb │ ├── model.rb │ ├── prompt.rb │ ├── rails │ ├── active_job_object_serializer.rb │ └── active_record_coders.rb │ ├── railtie.rb │ ├── utils │ ├── middleware_chain.rb │ ├── serializable_with_version.rb │ ├── serializer.rb │ ├── symbolize_keys.rb │ └── variables.rb │ └── version.rb └── test ├── anthropic ├── basic_test.rb └── multi_agent_test.rb ├── gemini └── basic_test.rb ├── improper_uses_test.rb ├── llm_completions_test.rb ├── middleware ├── chat_completion_middleware_test.rb └── chomp_middleware_test.rb ├── openai ├── basic_test.rb └── multi_agent_test.rb ├── prompt ├── hide_from_prompt_test.rb └── serialize_test.rb ├── rails ├── active_job_object_serializer_test.rb ├── active_record_coders_test.rb └── rails_test_helper.rb ├── rails_not_loaded_test.rb ├── safe_test.rb ├── test_helper.rb └── utils ├── assertions.rb ├── middleware.rb ├── mock_completion_model.rb ├── mock_completion_stream_response.rb ├── mock_completion_stream_response_test.rb └── serializable_with_version_test.rb /.envrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/.envrc -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/.gitignore -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/.rubocop.yml -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/.yardopts -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/Gemfile -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/README.md -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/Rakefile -------------------------------------------------------------------------------- /SCRATCHPAD.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/SCRATCHPAD.md -------------------------------------------------------------------------------- /devbox.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/devbox.json -------------------------------------------------------------------------------- /docs/anthropic-usage.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/docs/anthropic-usage.md -------------------------------------------------------------------------------- /docs/how-a-request-works.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/docs/how-a-request-works.md -------------------------------------------------------------------------------- /docs/openai-usage.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/docs/openai-usage.md -------------------------------------------------------------------------------- /docs/prompt-completion-middleware.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/docs/prompt-completion-middleware.md -------------------------------------------------------------------------------- /docs/streaming-usage.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/docs/streaming-usage.md -------------------------------------------------------------------------------- /examples/anthropic/cookbook/COOKBOOK-LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/COOKBOOK-LICENSE -------------------------------------------------------------------------------- /examples/anthropic/cookbook/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/README.md -------------------------------------------------------------------------------- /examples/anthropic/cookbook/patterns/agents/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/patterns/agents/README.md -------------------------------------------------------------------------------- /examples/anthropic/cookbook/patterns/agents/basic_workflows.ipynb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/patterns/agents/basic_workflows.ipynb -------------------------------------------------------------------------------- /examples/anthropic/cookbook/patterns/agents/evaluator_optimizer.ipynb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/patterns/agents/evaluator_optimizer.ipynb -------------------------------------------------------------------------------- /examples/anthropic/cookbook/patterns/agents/orchestrator_workers.ipynb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/anthropic/cookbook/patterns/agents/orchestrator_workers.ipynb -------------------------------------------------------------------------------- /examples/notebook.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/examples/notebook.rb -------------------------------------------------------------------------------- /instruct.gemspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/instruct.gemspec -------------------------------------------------------------------------------- /lib/instruct.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct.rb -------------------------------------------------------------------------------- /lib/instruct/compile_erb.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/compile_erb.rb -------------------------------------------------------------------------------- /lib/instruct/env.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/env.rb -------------------------------------------------------------------------------- /lib/instruct/error.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/error.rb -------------------------------------------------------------------------------- /lib/instruct/gen/completion_request.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/gen/completion_request.rb -------------------------------------------------------------------------------- /lib/instruct/gen/completion_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/gen/completion_response.rb -------------------------------------------------------------------------------- /lib/instruct/gen/gen.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/gen/gen.rb -------------------------------------------------------------------------------- /lib/instruct/gen/generate_completion.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/gen/generate_completion.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/erb_helper.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/erb_helper.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/gen_helper.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/gen_helper.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/helpers.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/helpers.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/model_helper.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/model_helper.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/monkeypatches.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/monkeypatches.rb -------------------------------------------------------------------------------- /lib/instruct/helpers/refinements.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/helpers/refinements.rb -------------------------------------------------------------------------------- /lib/instruct/llms/anthropic/completion_model.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/anthropic/completion_model.rb -------------------------------------------------------------------------------- /lib/instruct/llms/anthropic/messages_completion_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/anthropic/messages_completion_response.rb -------------------------------------------------------------------------------- /lib/instruct/llms/anthropic/middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/anthropic/middleware.rb -------------------------------------------------------------------------------- /lib/instruct/llms/gemini/chat_completion_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/gemini/chat_completion_response.rb -------------------------------------------------------------------------------- /lib/instruct/llms/gemini/completion_model.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/gemini/completion_model.rb -------------------------------------------------------------------------------- /lib/instruct/llms/gemini/middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/gemini/middleware.rb -------------------------------------------------------------------------------- /lib/instruct/llms/openai/chat_completion_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/openai/chat_completion_response.rb -------------------------------------------------------------------------------- /lib/instruct/llms/openai/completion_model.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/openai/completion_model.rb -------------------------------------------------------------------------------- /lib/instruct/llms/openai/completion_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/openai/completion_response.rb -------------------------------------------------------------------------------- /lib/instruct/llms/openai/middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/llms/openai/middleware.rb -------------------------------------------------------------------------------- /lib/instruct/middleware/chat_completion_middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/middleware/chat_completion_middleware.rb -------------------------------------------------------------------------------- /lib/instruct/middleware/chomp_middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/middleware/chomp_middleware.rb -------------------------------------------------------------------------------- /lib/instruct/model.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/model.rb -------------------------------------------------------------------------------- /lib/instruct/prompt.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/prompt.rb -------------------------------------------------------------------------------- /lib/instruct/rails/active_job_object_serializer.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/rails/active_job_object_serializer.rb -------------------------------------------------------------------------------- /lib/instruct/rails/active_record_coders.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/rails/active_record_coders.rb -------------------------------------------------------------------------------- /lib/instruct/railtie.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/railtie.rb -------------------------------------------------------------------------------- /lib/instruct/utils/middleware_chain.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/utils/middleware_chain.rb -------------------------------------------------------------------------------- /lib/instruct/utils/serializable_with_version.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/utils/serializable_with_version.rb -------------------------------------------------------------------------------- /lib/instruct/utils/serializer.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/utils/serializer.rb -------------------------------------------------------------------------------- /lib/instruct/utils/symbolize_keys.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/utils/symbolize_keys.rb -------------------------------------------------------------------------------- /lib/instruct/utils/variables.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/lib/instruct/utils/variables.rb -------------------------------------------------------------------------------- /lib/instruct/version.rb: -------------------------------------------------------------------------------- 1 | module Instruct 2 | VERSION = "0.1.0a1" 3 | end 4 | -------------------------------------------------------------------------------- /test/anthropic/basic_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/anthropic/basic_test.rb -------------------------------------------------------------------------------- /test/anthropic/multi_agent_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/anthropic/multi_agent_test.rb -------------------------------------------------------------------------------- /test/gemini/basic_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/gemini/basic_test.rb -------------------------------------------------------------------------------- /test/improper_uses_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/improper_uses_test.rb -------------------------------------------------------------------------------- /test/llm_completions_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/llm_completions_test.rb -------------------------------------------------------------------------------- /test/middleware/chat_completion_middleware_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/middleware/chat_completion_middleware_test.rb -------------------------------------------------------------------------------- /test/middleware/chomp_middleware_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/middleware/chomp_middleware_test.rb -------------------------------------------------------------------------------- /test/openai/basic_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/openai/basic_test.rb -------------------------------------------------------------------------------- /test/openai/multi_agent_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/openai/multi_agent_test.rb -------------------------------------------------------------------------------- /test/prompt/hide_from_prompt_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/prompt/hide_from_prompt_test.rb -------------------------------------------------------------------------------- /test/prompt/serialize_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/prompt/serialize_test.rb -------------------------------------------------------------------------------- /test/rails/active_job_object_serializer_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/rails/active_job_object_serializer_test.rb -------------------------------------------------------------------------------- /test/rails/active_record_coders_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/rails/active_record_coders_test.rb -------------------------------------------------------------------------------- /test/rails/rails_test_helper.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/rails/rails_test_helper.rb -------------------------------------------------------------------------------- /test/rails_not_loaded_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/rails_not_loaded_test.rb -------------------------------------------------------------------------------- /test/safe_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/safe_test.rb -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/test_helper.rb -------------------------------------------------------------------------------- /test/utils/assertions.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/assertions.rb -------------------------------------------------------------------------------- /test/utils/middleware.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/middleware.rb -------------------------------------------------------------------------------- /test/utils/mock_completion_model.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/mock_completion_model.rb -------------------------------------------------------------------------------- /test/utils/mock_completion_stream_response.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/mock_completion_stream_response.rb -------------------------------------------------------------------------------- /test/utils/mock_completion_stream_response_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/mock_completion_stream_response_test.rb -------------------------------------------------------------------------------- /test/utils/serializable_with_version_test.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instruct-rb/instruct/HEAD/test/utils/serializable_with_version_test.rb --------------------------------------------------------------------------------