{"id":13619130,"url":"https://github.com/mariochavez/llm_client","last_synced_at":"2025-10-06T09:30:37.761Z","repository":{"id":182939627,"uuid":"656341241","full_name":"mariochavez/llm_client","owner":"mariochavez","description":"Ruby client to connect to LLM Server.","archived":false,"fork":false,"pushed_at":"2023-06-21T01:01:18.000Z","size":27,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T08:11:43.249Z","etag":null,"topics":["client","llamacpp","llm","ruby"],"latest_commit_sha":null,"homepage":"https://mariochavez.io","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/mariochavez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-20T18:47:38.000Z","updated_at":"2024-02-08T07:47:07.000Z","dependencies_parsed_at":"2023-07-22T07:25:27.267Z","dependency_job_id":null,"html_url":"https://github.com/mariochavez/llm_client","commit_stats":null,"previous_names":["mariochavez/llm_client"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariochavez%2Fllm_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariochavez%2Fllm_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariochavez%2Fllm_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariochavez%2Fllm_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mariochavez","download_url":"https://codeload.github.com/mariochavez/llm_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235515428,"owners_count":19002481,"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":["client","llamacpp","llm","ruby"],"created_at":"2024-08-01T21:00:35.160Z","updated_at":"2025-10-06T09:30:32.427Z","avatar_url":"https://github.com/mariochavez.png","language":"Ruby","funding_links":[],"categories":["Ruby","Open Source"],"sub_categories":["API Libraries"],"readme":"# Llm Client\n\nRuby client to connect to [LLM Server](https://github.com/mariochavez/llm_server).\n\n## Demo\n\nhttps://github.com/mariochavez/llm_client/assets/59967/16b411b7-a538-4a96-91be-8979c99ff4aa\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add llm_client\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install llm_client\n\n## Usage\n\nTo start using the gem host configuration is need it. The host value is the URL where the LLM Server is running.\n\n```ruby\nLlmClient.host = \"http://localhost:9292\"\n```\n\nOptionally you can configure a Ruby Logger and log level.\n\n```ruby\nLlmClient.logger = Logger.new(STDOUT)\nLlmClient.log_level = LlmClient::LEVEL_DEBUG\n```\n\nValid log levels are:\n- `LlmClient::LEVEL_DEBUG`\n- `LlmClient::LEVEL_ERROR`\n- `LlmClient::LEVEL_INFO`\n\nWith configuration ready, you can start by checking that the LLM Server is up and running.\n\n```ruby\nresult = LlmClient.heartbeat\n\nif result.success?\n  puts \"Server is running\"\n  response = result.success\n  puts \"Status: #{response.status}\"\n  puts \"Body: #{response.body}\"\n  puts \"Headers: #{response.headers}\"\nelse\n  puts \"Server is not responding\"\n  error = result.failure\n  puts \"Error: #{error}\"\nend\n```\n\nNext, you can send a prompt to be completed by the LLM Server.\n\n```ruby\nresponse = LlmClient.completion(\"Who is the creator of Ruby language?\")\nif result.success?\n  puts \"Completions generated successfully\"\n  response = result.success\n  puts \"Status: #{response.status}\"\n  puts \"Body: #{response.body}\"\n  puts \"Headers: #{response.headers}\"\n  calculated_response = response.body[:response]\n  puts \"Calculated Response: #{calculated_response}\"\nelse\n  puts \"Failed to generate completions\"\n  error = result.failure\n  puts \"Error: #{error}\"\nend\n```\n\nThe response in both cases is a `Result` monad that wraps a `Response` struct.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You 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`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits 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/mariochavez/llm_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mariochavez/llm_client/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://github.com/mariochavez/llm_client/blob/main/LICENSE.txt).\n\n## Code of Conduct\n\nEveryone interacting in the LlmClient project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mariochavez/llm_client/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariochavez%2Fllm_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmariochavez%2Fllm_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariochavez%2Fllm_client/lists"}