Sha256: d65624365d9c7ed79031b901d6dfa255f131c388f06d37c8191fcbbeeecbffbb
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
# frozen_string_literal: true module OpenaiAssistant module Assistant # An openai assistant class Create < Base # @param model [String] Select model of the assistant. refer on: https://platform.openai.com/docs/api-reference/models/list. # @param instructions [String] The system instructions that the assistant uses. # @return [OpenaiAssistant::Mapper::Assistant] A new response object of assistant. def create_assistant(model, instructions) url = URI.parse(@openai_url) req_body = { "instructions": instructions, "name": "assistant", "tools": [{ "type": "code_interpreter" }], "model": model }.to_json response = @http_client.call_post(url, req_body, default_headers) return OpenaiAssistant::ErrorResponse.from_json(response.body) unless response.code == "200" OpenaiAssistant::Mapper::Assistant.from_json(JSON.parse(response.body)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openai-assistant-1.1.0 | lib/openai_assistant/clients/assistant/create.rb |