Class: LLM::DeepSeek::Files

Inherits:
OpenAI::Files
  • Object
show all
Defined in:
lib/llm/providers/deepseek/files.rb

Overview

The LLM::DeepSeek::Files class provides a files object for interacting with DeepSeek's Files API. The files API lets a client upload images and reference them later by file_id - for example in chat requests to deepseek-flash - without re-uploading them. DeepSeek supports the JPEG, PNG, GIF, and WebP formats, and a single file may be at most 64 MiB.

DeepSeek's Files API is OpenAI-compatible, with two differences from OpenAI's: it is served from the root of the API host (not under /v1), and the purpose of an upload must be "user_data".

Examples:

example #1

#!/usr/bin/env ruby
require "llm"

llm = LLM.deepseek(key: ENV["KEY"])
file = llm.files.create file: "/images/photo.jpg"
print "id: ", file.id, "\n"

Instance Method Summary collapse

Instance Method Details

#create(file:, purpose: "user_data", **params) ⇒ LLM::Response

Create a file

Examples:

llm = LLM.deepseek(key: ENV["KEY"])
res = llm.files.create file: "/images/photo.jpg"

Parameters:

  • file (File, LLM::File, String) —

    The file

  • purpose (String) (defaults to: "user_data") —

    The purpose of the file (DeepSeek only supports "user_data")

  • params (Hash) —

    Other parameters (see DeepSeek docs)

Returns:

See Also:



35
36
37
# File 'lib/llm/providers/deepseek/files.rb', line 35

def create(file:, purpose: "user_data", **params)
  super
end