{"id":25949814,"url":"https://github.com/ksylvest/omniai-deepseek","last_synced_at":"2025-03-04T12:29:23.667Z","repository":{"id":275021910,"uuid":"924833495","full_name":"ksylvest/omniai-deepseek","owner":"ksylvest","description":"An implementation of the OmniAI interface for DeepSeek.","archived":false,"fork":false,"pushed_at":"2025-02-26T15:10:40.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T16:24:05.339Z","etag":null,"topics":["deepseek","omniai","ruby"],"latest_commit_sha":null,"homepage":"https://omniai-deepseek.ksylvest.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksylvest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-30T18:24:04.000Z","updated_at":"2025-02-26T15:10:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2dd416b-8ca1-43f4-a518-e4e9f5dbcd25","html_url":"https://github.com/ksylvest/omniai-deepseek","commit_stats":null,"previous_names":["ksylvest/omniai-deepseek"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-deepseek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-deepseek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-deepseek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-deepseek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksylvest","download_url":"https://codeload.github.com/ksylvest/omniai-deepseek/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241847504,"owners_count":20030267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepseek","omniai","ruby"],"created_at":"2025-03-04T12:29:22.974Z","updated_at":"2025-03-04T12:29:23.633Z","avatar_url":"https://github.com/ksylvest.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OmniAI::DeepSeek\n\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ksylvest/omniai-deepseek/blob/main/LICENSE)\n[![RubyGems](https://img.shields.io/gem/v/omniai-deepseek)](https://rubygems.org/gems/omniai-deepseek)\n[![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/ksylvest/omniai-deepseek)\n[![Yard](https://img.shields.io/badge/docs-site-blue.svg)](https://omniai-deepseek.ksylvest.com)\n[![CircleCI](https://img.shields.io/circleci/build/github/ksylvest/omniai-deepseek)](https://circleci.com/gh/ksylvest/omniai-deepseek)\n\nAn DeepSeek implementation of the [OmniAI](https://github.com/ksylvest/omniai) interface for [deepseek](https://www.deepseek.com/).\n\n## Installation\n\n```sh\ngem install omniai-deepseek\n```\n\n## Usage\n\n### Client\n\nA client is setup as follows if `ENV['DEEPSEEK_API_KEY']` exists:\n\n```ruby\nclient = OmniAI::DeepSeek::Client.new\n```\n\nA client may also be passed the following options:\n\n- `api_key` (required - default is `ENV['DEEPSEEK_API_KEY']`)\n- `host` (optional)\n\n### Configuration\n\nGlobal configuration is supported for the following options:\n\n```ruby\nOmniAI::DeepSeek.configure do |config|\n  config.api_key = 'sk-...' # default: ENV['DEEPSEEK_API_KEY']\n  config.host = '...' # default: 'https://api.deepseek.com'\nend\n```\n\n### Chat\n\nA chat completion is generated by passing in a simple text prompt:\n\n```ruby\ncompletion = client.chat('Tell me a joke!')\ncompletion.content # 'Why did the chicken cross the road? To get to the other side.'\n```\n\nA chat completion may also be generated by using a prompt builder:\n\n```ruby\ncompletion = client.chat do |prompt|\n  prompt.system('Your are an expert in geography.')\n  prompt.user('What is the capital of Canada?')\nend\ncompletion.content # 'The capital of Canada is Ottawa.'\n```\n\n#### Model\n\n`model` takes an optional string (default is `deepseek-chat`):\n\n```ruby\ncompletion = client.chat('How fast is a cheetah?', model: OmniAI::DeepSeek::Chat::Model::REASONER)\ncompletion.content # 'A cheetah can reach speeds over 100 km/h.'\n```\n\n[DeepSeek API Reference `model`](https://api-docs.deepseek.com/quick_start/pricing)\n\n#### Temperature\n\n`temperature` takes an optional float between `0.0` and `2.0` (defaults is `0.7`):\n\n```ruby\ncompletion = client.chat('Pick a number between 1 and 5', temperature: 2.0)\ncompletion.content # '3'\n```\n\n[DeepSeek API Reference `temperature`](https://api-docs.deepseek.com/quick_start/parameter_settings)\n\n#### Stream\n\n`stream` takes an optional a proc to stream responses in real-time chunks instead of waiting for a complete response:\n\n```ruby\nstream = proc do |chunk|\n  print(chunk.content) # 'Better', 'three', 'hours', ...\nend\nclient.chat('Be poetic.', stream:)\n```\n\n[DeepSeek API Reference `stream`](https://platform.deepseek.com/docs/api-reference/chat/create#chat-create-stream)\n\n#### Format\n\n`format` takes an optional symbol (`:json`) and that setes the `response_format` to `json_object`:\n\n```ruby\ncompletion = client.chat(format: :json) do |prompt|\n  prompt.system(OmniAI::Chat::JSON_PROMPT)\n  prompt.user('What is the name of the drummer for the Beatles?')\nend\nJSON.parse(completion.content) # { \"name\": \"Ringo\" }\n```\n\n[DeepSeek API Reference `response_format`](https://platform.deepseek.com/docs/api-reference/chat/create#chat-create-stream)\n\n\u003e When using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksylvest%2Fomniai-deepseek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksylvest%2Fomniai-deepseek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksylvest%2Fomniai-deepseek/lists"}