Skip to content

Commit 13b393d

Browse files
committed
Initial commit
Set up a Ruby gem with a basic client. The goal is to have a gem that can be used to interact with the DeepSeek API and try their services. https://api-docs.deepseek.com
0 parents  commit 13b393d

File tree

17 files changed

+331
-0
lines changed

17 files changed

+331
-0
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Ruby
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.3.7'
18+
- '3.4.1'
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: ${{ matrix.ruby }}
26+
bundler-cache: true
27+
- name: Run the default task
28+
env:
29+
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
30+
run: bundle exec rake

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
Gemfile.lock
10+
*.gem
11+
.byebug_history
12+
.env

.standard.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# For available configuration options, see:
2+
# https://github.com/standardrb/standard
3+
ruby_version: 3.1

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## [Unreleased]
2+
3+
## [0.1.0] - 2025-01-26
4+
5+
- Initial release

Gemfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
# Specify your gem's dependencies in deepseek.gemspec
6+
gemspec
7+
8+
gem "rake", "~> 13.0"
9+
10+
gem "minitest", "~> 5.16"
11+
12+
gem "standard", "~> 1.3"
13+
14+
gem "byebug", "~> 11.1"
15+
16+
gem "dotenv", "~> 3.1"

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2025 Adrián Mugnolo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Deepseek
2+
3+
A Ruby client for accessing the DeepSeek API.
4+
5+
## Installation
6+
7+
Install the gem and add to the application's Gemfile by executing:
8+
9+
```bash
10+
bundle add deepseek
11+
```
12+
13+
If bundler is not being used to manage dependencies, install the gem by
14+
executing:
15+
16+
```bash
17+
gem install deepseek
18+
```
19+
20+
## Usage
21+
22+
```ruby
23+
client = Deepseek::Client.new("your-api-key")
24+
25+
response = client.chat_completions(
26+
model: "deepseek-chat",
27+
messages: [{role: "user", content: "Hello, world!"}]
28+
)
29+
```
30+
31+
## Development
32+
33+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
34+
`rake test` to run the tests. You can also run `bin/console` for an interactive
35+
prompt that will allow you to experiment.
36+
37+
To install this gem onto your local machine, run `bundle exec rake install`. To
38+
release a new version, update the version number in `version.rb`, and then run
39+
`bundle exec rake release`, which will create a git tag for the version, push
40+
git commits and the created tag, and push the `.gem` file to
41+
[rubygems.org](https://rubygems.org).
42+
43+
## Contributing
44+
45+
Bug reports and pull requests are welcome on GitHub at
46+
https://github.com/xymbol/deepseek-ruby.
47+
48+
## License
49+
50+
The gem is available as open source under the terms of the [MIT
51+
License](https://opensource.org/licenses/MIT).

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
require "bundler/gem_tasks"
4+
require "minitest/test_task"
5+
6+
Minitest::TestTask.create
7+
8+
require "standard/rake"
9+
10+
task default: %i[test standard]

bin/console

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "bundler/setup"
5+
require "deepseek"
6+
7+
# You can add fixtures and/or initialization code here to make experimenting
8+
# with your gem easier. You can also use a different console, if you like.
9+
10+
require "irb"
11+
IRB.start(__FILE__)

bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here

0 commit comments

Comments
 (0)