Class: LLM::DeepSeek::Images
- Inherits:
-
Object
- Object
- LLM::DeepSeek::Images
- Defined in:
- lib/llm/providers/deepseek/images.rb
Overview
The LLM::DeepSeek::Images class provides image generation capabilities through DeepSeek.
DeepSeek does not provide an image generation model however its text-to-text models can generate vector graphics (SVGS) and that's the approach that this class takes. It is somewhat experimental.
An SVG document can be converted to PNG or another format with tools like rsvg-convert.
Instance Method Summary collapse
-
#create(prompt:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) ⇒ LLM::Response<LLM::DeepSeek::ResponseAdapter::Image>
Returns a response.
-
#edit(prompt:, image:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) ⇒ LLM::Response<LLM::DeepSeek::ResponseAdapter::Image>
Returns a response.
- #initialize(provider) ⇒ LLM::DeepSeek::Images constructor
Constructor Details
#initialize(provider) ⇒ LLM::DeepSeek::Images
19 20 21 |
# File 'lib/llm/providers/deepseek/images.rb', line 19 def initialize(provider) @provider = provider end |
Instance Method Details
#create(prompt:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) ⇒ LLM::Response<LLM::DeepSeek::ResponseAdapter::Image>
Returns a response
45 46 47 48 49 50 51 |
# File 'lib/llm/providers/deepseek/images.rb', line 45 def create(prompt:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) agent ||= LLM::Agent.new(@provider, model:, instructions: create_instructions, response_format: {type: "json_object"}) res = agent.talk(prompt) res = LLM::DeepSeek::ResponseAdapter.adapt(res, type: :image) res.define_singleton_method(:agent) { agent } res end |
#edit(prompt:, image:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) ⇒ LLM::Response<LLM::DeepSeek::ResponseAdapter::Image>
Returns a response
77 78 79 80 81 82 83 84 |
# File 'lib/llm/providers/deepseek/images.rb', line 77 def edit(prompt:, image:, model: @provider.default_model, agent: nil, size: nil, n: nil, response_format: nil, quality: nil, style: nil) file = LLM.File(image) agent ||= LLM::Agent.new(@provider, model:, instructions: edit_instructions(file), response_format: {type: "json_object"}) res = agent.talk(prompt) res = LLM::DeepSeek::ResponseAdapter.adapt(res, type: :image) res.define_singleton_method(:agent) { agent } res end |