Sha256: 90ccace81bc34c8c16468b1fa8f255f7a56d3d902ef013cfbaee89cdf3b5bd47

Contents?: true

Size: 373 Bytes

Versions: 5

Compression:

Stored size: 373 Bytes

Contents

# frozen_string_literal: true

module GenAI
  module Api
    module Format
      module OpenAI
        def extract_embeddings(response)
          response['data'].map { |datum| datum['embedding'] }
        end

        def extract_completions(response)
          response['choices'].map { |choice| choice.dig('message', 'content') }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gen-ai-0.4.1 lib/gen_ai/api/format/open_ai.rb
gen-ai-0.4.0 lib/gen_ai/api/format/open_ai.rb
gen-ai-0.4.0.alpha.3 lib/gen_ai/api/format/open_ai.rb
gen-ai-0.4.0.alpha.2 lib/gen_ai/api/format/open_ai.rb
gen-ai-0.4.0.alpha.1 lib/gen_ai/api/format/open_ai.rb