{"id":26873838,"url":"https://github.com/npezza93/activeclient","last_synced_at":"2026-01-08T15:34:28.706Z","repository":{"id":283890684,"uuid":"953207742","full_name":"npezza93/activeclient","owner":"npezza93","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-22T20:36:08.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T21:28:03.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/npezza93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-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-03-22T20:16:38.000Z","updated_at":"2025-03-22T20:36:11.000Z","dependencies_parsed_at":"2025-03-23T00:15:21.804Z","dependency_job_id":null,"html_url":"https://github.com/npezza93/activeclient","commit_stats":null,"previous_names":["npezza93/activeclient"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npezza93%2Factiveclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npezza93%2Factiveclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npezza93%2Factiveclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npezza93%2Factiveclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npezza93","download_url":"https://codeload.github.com/npezza93/activeclient/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246446999,"owners_count":20778901,"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":"2025-03-31T09:31:47.167Z","updated_at":"2026-01-08T15:34:28.660Z","avatar_url":"https://github.com/npezza93.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveClient\n\nBasic API client interface\n\n## Example OpenAI client\n\n```ruby\nclass OpenAI \u003c ActiveClient::Base\n  class BadRequestError \u003c StandardError\n  end\n\n  def initialize(model = \"gpt-4o-mini-2024-07-18\")\n    @model = model\n    super()\n  end\n\n  def response(input, name, schema, tools = [])\n    response = post \"responses\", **request_params(input, name, schema, tools)\n\n    raise BadRequestError, response unless response.success?\n\n    JSON.parse(response.body.to_h[\"output\"].\n      find { it[\"type\"] == \"message\" }.dig(\"content\", 0, \"text\"))\n  end\n\n  def create_vector_store(name, *file_ids)\n    post(\"vector_stores\", name:, file_ids:,\n                          expires_after: { days: 1, anchor: :last_active_at })\n  end\n\n  def vector_store(id)\n    get(\"vector_stores/#{id}\")\n  end\n\n  def vector_stores\n    get(\"vector_stores\")\n  end\n\n  def files\n    get(\"files\")\n  end\n\n  def upload_file(name, content)\n    multipart_post(\"files\", [%w(purpose user_data),\n                             [\"file\", StringIO.new(content),\n                              { filename: name, content_type: \"text/plain\" }]])\n  end\n\n  private\n\n    attr_reader :model\n\n    def default_headers = super.merge(\"Authorization\" =\u003e token_header)\n    def base_url = \"https://api.openai.com/v1\"\n    def token_header = \"Bearer #{credentials.dig(:open_ai, :token)}\"\n\n    def request_params(input, name, schema, tools)\n      { input:, model:, store: false, top_p: 1.0, tools:, text: { format: {\n        type: :json_schema, name:, schema:, strict: true\n      } } }\n    end\nend\n```\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"activeclient_api\"\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install activeclient_api\n```\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpezza93%2Factiveclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpezza93%2Factiveclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpezza93%2Factiveclient/lists"}