{"id":16056070,"url":"https://github.com/ksylvest/omniai-mistral","last_synced_at":"2025-10-26T07:35:59.300Z","repository":{"id":244519667,"uuid":"813255128","full_name":"ksylvest/omniai-mistral","owner":"ksylvest","description":"An implementation of the OmniAI interface for Mistral.","archived":false,"fork":false,"pushed_at":"2025-09-26T16:13:57.000Z","size":87,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-13T19:39:51.628Z","etag":null,"topics":["lechat","mistral","omniai","ruby"],"latest_commit_sha":null,"homepage":"https://omniai-mistral.ksylvest.com","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/ksylvest.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-10T19:16:03.000Z","updated_at":"2025-09-26T16:14:00.000Z","dependencies_parsed_at":"2024-06-15T10:33:30.472Z","dependency_job_id":"9eb5c12f-9667-449b-86f0-c9f0262b98d6","html_url":"https://github.com/ksylvest/omniai-mistral","commit_stats":null,"previous_names":["ksylvest/omniai-mistral"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/ksylvest/omniai-mistral","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-mistral","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-mistral/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-mistral/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-mistral/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksylvest","download_url":"https://codeload.github.com/ksylvest/omniai-mistral/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksylvest%2Fomniai-mistral/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281074239,"owners_count":26439421,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["lechat","mistral","omniai","ruby"],"created_at":"2024-10-09T02:40:26.129Z","updated_at":"2025-10-26T07:35:59.253Z","avatar_url":"https://github.com/ksylvest.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OmniAI::Mistral\n\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ksylvest/omniai-mistral/blob/main/LICENSE)\n[![RubyGems](https://img.shields.io/gem/v/omniai-mistral)](https://rubygems.org/gems/omniai-mistral)\n[![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/ksylvest/omniai-mistral)\n[![Yard](https://img.shields.io/badge/docs-site-blue.svg)](https://omniai-mistral.ksylvest.com)\n[![CircleCI](https://img.shields.io/circleci/build/github/ksylvest/omniai-mistral)](https://circleci.com/gh/ksylvest/omniai-mistral)\n\nAn Mistral implementation of the [OmniAI](https://github.com/ksylvest/omniai) APIs.\n\n## Installation\n\n```sh\ngem install omniai-mistral\n```\n\n## Usage\n\n### Client\n\nA client is setup as follows if `ENV['MISTRAL_API_KEY']` exists:\n\n```ruby\nclient = OmniAI::Mistral::Client.new\n```\n\nA client may also be passed the following options:\n\n- `api_key` (required - default is `ENV['MISTRAL_API_KEY']`)\n- `host` (optional)\n\n### Configuration\n\nGlobal configuration is supported for the following options:\n\n```ruby\nOmniAI::Mistral.configure do |config|\n  config.api_key = 'sk-...' # default: ENV['MISTRAL_API_KEY']\n  config.host = '...' # default: 'https://api.mistral.ai'\nend\n```\n\n### Chat\n\nA chat completion is generated by passing in prompts using any a variety of formats:\n\n```ruby\ncompletion = client.chat('Tell me a joke!')\ncompletion.text # 'Why did the chicken cross the road? To get to the other side.'\n```\n\n```ruby\ncompletion = client.chat do |prompt|\n  prompt.system('You are a helpful assistant.')\n  prompt.user('What is the capital of Canada?')\nend\ncompletion.text # 'The capital of Canada is Ottawa.'\n```\n\n#### Model\n\n`model` takes an optional string (default is `mistral-medium-latest`):\n\n```ruby\ncompletion = client.chat('Provide code for fibonacci', model: OmniAI::Mistral::Chat::Model::CODESTRAL)\ncompletion.text # 'def fibonacci(n)...end'\n```\n\n[Mistral API Reference `model`](https://docs.mistral.ai/getting-started/models/)\n\n#### Temperature\n\n`temperature` takes an optional float between `0.0` and `1.0` (defaults is `0.7`):\n\n```ruby\ncompletion = client.chat('Pick a number between 1 and 5', temperature: 1.0)\ncompletion.text # '3'\n```\n\n[Mistral API Reference `temperature`](https://docs.mistral.ai/api/)\n\n#### Stream\n\n`stream` takes an optional a proc to stream responses in real-time chunks instead of waiting for a complete response:\n\n```ruby\nstream = proc do |chunk|\n  print(chunk.text) # 'Better', 'three', 'hours', ...\nend\nclient.chat('Be poetic.', stream:)\n```\n\n[Mistral API Reference `stream`](https://docs.mistral.ai/api/)\n\n#### Format\n\n`format` takes an optional symbol (`:json`) and that sets the `response_format` to `json_object`:\n\n```ruby\ncompletion = client.chat(format: :json) do |prompt|\n  prompt.system(OmniAI::Chat::JSON_PROMPT)\n  prompt.user('What is the name of the drummer for the Beatles?')\nend\nJSON.parse(completion.text) # { \"name\": \"Ringo\" }\n```\n\n[Mistral API Reference `response_format`](https://docs.mistral.ai/api/)\n\n\u003e When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message.\n\n### Embed\n\nText can be converted into a vector embedding for similarity comparison usage via:\n\n```ruby\nresponse = client.embed('The quick brown fox jumps over a lazy dog.')\nresponse.embedding # [0.0, ...]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksylvest%2Fomniai-mistral","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksylvest%2Fomniai-mistral","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksylvest%2Fomniai-mistral/lists"}