{"id":31641907,"url":"https://github.com/openlayer-ai/openlayer-ruby","last_synced_at":"2026-03-03T14:04:29.061Z","repository":{"id":317399099,"uuid":"1067093109","full_name":"openlayer-ai/openlayer-ruby","owner":"openlayer-ai","description":"The official Ruby library for Openlayer, the Evaluation Platform for AI. 📈","archived":false,"fork":false,"pushed_at":"2026-01-14T17:24:52.000Z","size":403,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-15T16:32:55.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openlayer-ai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-30T11:19:43.000Z","updated_at":"2026-01-14T17:24:15.000Z","dependencies_parsed_at":"2025-10-15T11:46:22.742Z","dependency_job_id":null,"html_url":"https://github.com/openlayer-ai/openlayer-ruby","commit_stats":null,"previous_names":["openlayer-ai/openlayer-ruby"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/openlayer-ai/openlayer-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openlayer-ai%2Fopenlayer-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openlayer-ai%2Fopenlayer-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openlayer-ai%2Fopenlayer-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openlayer-ai%2Fopenlayer-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openlayer-ai","download_url":"https://codeload.github.com/openlayer-ai/openlayer-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openlayer-ai%2Fopenlayer-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-10-07T03:26:12.560Z","updated_at":"2026-02-27T18:56:08.552Z","avatar_url":"https://github.com/openlayer-ai.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openlayer Ruby API library\n\nThe Openlayer Ruby library provides convenient access to the Openlayer REST API from any Ruby 3.2.0+ application. It ships with comprehensive types \u0026 docstrings in Yard, RBS, and RBI – [see below](https://github.com/openlayer-ai/openlayer-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/openlayer).\n\nThe REST API documentation can be found on [openlayer.com](https://openlayer.com/docs/api-reference/rest/overview).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application's `Gemfile`:\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```ruby\ngem \"openlayer\", \"~\u003e 0.10.9\"\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## Usage\n\n```ruby\nrequire \"bundler/setup\"\nrequire \"openlayer\"\n\nopenlayer = Openlayer::Client.new(\n  api_key: ENV[\"OPENLAYER_API_KEY\"] # This is the default and can be omitted\n)\n\nresponse = openlayer.inference_pipelines.data.stream(\n  \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n  config: {\n    inputVariableNames: [\"user_query\"],\n    outputColumnName: \"output\",\n    numOfTokenColumnName: \"tokens\",\n    costColumnName: \"cost\",\n    timestampColumnName: \"timestamp\"\n  },\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}]\n)\n\nputs(response.success)\n```\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Openlayer::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n  data = openlayer.inference_pipelines.data.stream(\n    \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n    config: {\n      inputVariableNames: [\"user_query\"],\n      outputColumnName: \"output\",\n      numOfTokenColumnName: \"tokens\",\n      costColumnName: \"cost\",\n      timestampColumnName: \"timestamp\"\n    },\n    rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}]\n  )\nrescue Openlayer::Errors::APIConnectionError =\u003e e\n  puts(\"The server could not be reached\")\n  puts(e.cause)  # an underlying Exception, likely raised within `net/http`\nrescue Openlayer::Errors::RateLimitError =\u003e e\n  puts(\"A 429 status code was received; we should back off a bit.\")\nrescue Openlayer::Errors::APIStatusError =\u003e e\n  puts(\"Another non-200-range status code was received\")\n  puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause            | Error Type                 |\n| ---------------- | -------------------------- |\n| HTTP 400         | `BadRequestError`          |\n| HTTP 401         | `AuthenticationError`      |\n| HTTP 403         | `PermissionDeniedError`    |\n| HTTP 404         | `NotFoundError`            |\n| HTTP 409         | `ConflictError`            |\n| HTTP 422         | `UnprocessableEntityError` |\n| HTTP 429         | `RateLimitError`           |\n| HTTP \u003e= 500      | `InternalServerError`      |\n| Other HTTP error | `APIStatusError`           |\n| Timeout          | `APITimeoutError`          |\n| Network error    | `APIConnectionError`       |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, \u003e=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nopenlayer = Openlayer::Client.new(\n  max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nopenlayer.inference_pipelines.data.stream(\n  \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n  config: {\n    inputVariableNames: [\"user_query\"],\n    outputColumnName: \"output\",\n    numOfTokenColumnName: \"tokens\",\n    costColumnName: \"cost\",\n    timestampColumnName: \"timestamp\"\n  },\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}],\n  request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nopenlayer = Openlayer::Client.new(\n  timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nopenlayer.inference_pipelines.data.stream(\n  \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n  config: {\n    inputVariableNames: [\"user_query\"],\n    outputColumnName: \"output\",\n    numOfTokenColumnName: \"tokens\",\n    costColumnName: \"cost\",\n    timestampColumnName: \"timestamp\"\n  },\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}],\n  request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Openlayer::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Openlayer::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj =\u003e {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\nresponse =\n  openlayer.inference_pipelines.data.stream(\n    \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n    config: {\n      inputVariableNames: [\"user_query\"],\n      outputColumnName: \"output\",\n      numOfTokenColumnName: \"tokens\",\n      costColumnName: \"cost\",\n      timestampColumnName: \"timestamp\"\n    },\n    rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}],\n    request_options: {\n      extra_query: {my_query_parameter: value},\n      extra_body: {my_body_parameter: value},\n      extra_headers: {\"my-header\": value}\n    }\n  )\n\nputs(response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n  method: :post,\n  path: '/undocumented/endpoint',\n  query: {\"dog\": \"woof\"},\n  headers: {\"useful-header\": \"interesting-value\"},\n  body: {\"hello\": \"world\"}\n)\n```\n\n### Concurrency \u0026 connection pooling\n\nThe `Openlayer::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Openlayer::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nopenlayer.inference_pipelines.data.stream(\n  \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n  config: Openlayer::InferencePipelines::DataStreamParams::Config::LlmData.new(\n    input_variable_names: [\"user_query\"],\n    output_column_name: \"output\",\n    num_of_token_column_name: \"tokens\",\n    cost_column_name: \"cost\",\n    timestamp_column_name: \"timestamp\"\n  ),\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}]\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nopenlayer.inference_pipelines.data.stream(\n  \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n  config: {\n    inputVariableNames: [\"user_query\"],\n    outputColumnName: \"output\",\n    numOfTokenColumnName: \"tokens\",\n    costColumnName: \"cost\",\n    timestampColumnName: \"timestamp\"\n  },\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}]\n)\n\n# You can also splat a full Params class:\nparams = Openlayer::InferencePipelines::DataStreamParams.new(\n  config: Openlayer::InferencePipelines::DataStreamParams::Config::LlmData.new(\n    input_variable_names: [\"user_query\"],\n    output_column_name: \"output\",\n    num_of_token_column_name: \"tokens\",\n    cost_column_name: \"cost\",\n    timestamp_column_name: \"timestamp\"\n  ),\n  rows: [{user_query: \"what is the meaning of life?\", output: \"42\", tokens: 7, cost: 0.02, timestamp: 1610000000}]\n)\nopenlayer.inference_pipelines.data.stream(\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\", **params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide \"tagged symbols\" instead, which is always a primitive at runtime:\n\n```ruby\n# :\"llm-base\"\nputs(Openlayer::ProjectCreateParams::TaskType::LLM_BASE)\n\n# Revealed type: `T.all(Openlayer::ProjectCreateParams::TaskType, Symbol)`\nT.reveal_type(Openlayer::ProjectCreateParams::TaskType::LLM_BASE)\n```\n\nEnum parameters have a \"relaxed\" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nopenlayer.projects.create(\n  task_type: Openlayer::ProjectCreateParams::TaskType::LLM_BASE,\n  # …\n)\n\n# Literal values are also permissible:\nopenlayer.projects.create(\n  task_type: :\"llm-base\",\n  # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/openlayer-ai/openlayer-ruby/tree/main/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenlayer-ai%2Fopenlayer-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenlayer-ai%2Fopenlayer-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenlayer-ai%2Fopenlayer-ruby/lists"}