Class: Roseflow::OpenAI::EmbeddingApiResponse
- Inherits:
-
ApiResponse
- Object
- ApiResponse
- Roseflow::OpenAI::EmbeddingApiResponse
- Defined in:
- lib/roseflow/openai/response.rb
Overview
ImageApiResponse
Instance Method Summary collapse
Methods inherited from ApiResponse
#initialize, #status, #success?
Constructor Details
This class inherits a constructor from Roseflow::OpenAI::ApiResponse
Instance Method Details
#body ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/roseflow/openai/response.rb', line 76 def body @body ||= begin case @response.status when 200 EmbeddingApiResponseBody.new(JSON.parse(@response.body)) else EmbeddingApiResponseErrorBody.new(JSON.parse(@response.body)) end end end |
#embedding ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/roseflow/openai/response.rb', line 87 def case @response.status when 200 body.data.map { || Embedding.new() }.first else raise FailedToCreateEmbeddingError, body.error. end end |