{"id":16317681,"url":"https://github.com/zfletch/llama-rb","last_synced_at":"2025-10-30T13:02:47.230Z","repository":{"id":149993799,"uuid":"622224012","full_name":"zfletch/llama-rb","owner":"zfletch","description":"Ruby wrapper for llama.cpp","archived":false,"fork":false,"pushed_at":"2023-04-16T16:08:44.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T09:41:52.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/zfletch.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":"2023-04-01T13:42:56.000Z","updated_at":"2024-12-24T20:19:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d9c4fcc-bdd9-43a3-b63d-e2cdcd6d7439","html_url":"https://github.com/zfletch/llama-rb","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fllama-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fllama-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fllama-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfletch%2Fllama-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfletch","download_url":"https://codeload.github.com/zfletch/llama-rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183818,"owners_count":19430199,"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":[],"created_at":"2024-10-10T22:09:00.540Z","updated_at":"2025-10-25T17:30:48.696Z","avatar_url":"https://github.com/zfletch.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Llama-rb\n\nRuby wrapper for\n[llama.cpp](https://github.com/ggerganov/llama.cpp).\n\nThis was hacked together in a weekend and versions `0.x.x` should be considered unstable. \n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```\n$ bundle add llama-rb\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```\n$ gem install llama-rb\n```\n\n## Usage\n\n### Models\n\nBefore using this code, you will need to download and process at least one. See\n[ggerganov/llama.cpp](https://github.com/ggerganov/llama.cpp#obtaining-and-verifying-the-facebook-llama-original-model-and-stanford-alpaca-model-data).\n\n### Example\n\n```ruby\nrequire 'llama'\n\nm = Llama::Model.new('models/7B/ggml-model-q4_0.bin')\nm.predict('hello world')\n```\n\n### API\n\n#### Llama::Model.new\n\n```ruby\nrequire 'llama'\n\nLlama::Model.new('models/7B/ggml-model-q4_0.bin')\n```\n\nOptional arguments:\n\n```ruby\nseed           # RNG seed (default Time.now.to_i)\nn_predict      # number of tokens to predict (default: 128, -1 = infinity)\nthreads        # number of threads to use during computation (default: 4)\ntop_k          # top-k sampling (default: 40)\ntop_p          # top-p sampling (default: 0.9)\nrepeat_last_n  # last n tokens to consider for penalize (default: 64)\nrepeat_penalty # penalize repeat sequence of tokens (default: 1.1)\nctx_size       # size of the prompt context (default: 512)\nignore_eos     # ignore end of stream token and continue generating\nmemory_f32     # use f32 instead of f16 for memory key+value\ntemp           # temperature (default: 0.8)\nn_parts        # number of model parts (default: -1 = determine from dimensions)\nbatch_size     # batch size for prompt processing (default: 8)\nkeep           # number of tokens to keep from the initial prompt (default: 0, -1 = all)\nmlock          # force system to keep model in RAM rather than swapping or compressing\n```\n\n#### Llama::Model#predict\n\n```ruby\nmodel.predict('hello world')\n```\n\n## Development\n\n```\ngit clone --recurse-submodules https://github.com/zfletch/llama-rb\ncd llama-rb\n./bin/setup\n```\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nThen, run `rake spec` to run the tests.\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\nTo release a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push git\ncommits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/zfletch/llama-rb.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfletch%2Fllama-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfletch%2Fllama-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfletch%2Fllama-rb/lists"}