{"id":31212686,"url":"https://github.com/alexitc/geminilive4s","last_synced_at":"2025-09-21T08:00:23.723Z","repository":{"id":311442616,"uuid":"1043706582","full_name":"AlexITC/geminilive4s","owner":"AlexITC","description":"Interact with Gemini Live API (Audio) for Scala","archived":false,"fork":false,"pushed_at":"2025-09-07T11:49:15.000Z","size":37,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-07T12:22:58.431Z","etag":null,"topics":["ai","audio","gemini","scala"],"latest_commit_sha":null,"homepage":"https://alexitc.com/blog/2025-08-25-introducing-geminilive4s/","language":"Scala","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/AlexITC.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}},"created_at":"2025-08-24T12:58:01.000Z","updated_at":"2025-09-07T10:39:31.000Z","dependencies_parsed_at":"2025-08-24T18:47:00.188Z","dependency_job_id":"ea04e8f7-ef1a-4a2e-a436-8577c2257d9f","html_url":"https://github.com/AlexITC/geminilive4s","commit_stats":null,"previous_names":["alexitc/geminilive4s"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexITC/geminilive4s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexITC%2Fgeminilive4s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexITC%2Fgeminilive4s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexITC%2Fgeminilive4s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexITC%2Fgeminilive4s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexITC","download_url":"https://codeload.github.com/AlexITC/geminilive4s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexITC%2Fgeminilive4s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276210404,"owners_count":25603724,"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-09-21T02:00:07.055Z","response_time":72,"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":["ai","audio","gemini","scala"],"created_at":"2025-09-21T08:00:19.989Z","updated_at":"2025-09-21T08:00:23.699Z","avatar_url":"https://github.com/AlexITC.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geminilive4s\n\nA library for integrating real-time, conversational AI voice with Scala and the Google Gemini Live API.\n\n---\n\n## Goal\n\nThe project's goal is to provide a Scala-friendly wrapper over [google-genai](https://cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview) SDK, being simple enough to get started while allowing to override any of the `google-genai` settings.\n\nAs of now, this exposes a [fs2](https://fs2.io) stream where you can an audio stream to Gemini, producing Gemini's audio stream.\n\nOne of the key features is supporting [Automatic Function Calling](https://ai.google.dev/gemini-api/docs/function-calling) which allows Gemini to invoke Scala functions.\n\n\n## How to use\n\nPick the latest version from the [releases](https://github.com/AlexITC/geminilive4s/releases) page, then, add the dependency to your `build.sbt`:\n\n```scala\nlibraryDependencies += \"com.alexitc.geminilive4s\" %% \"audio\" % \"0.3.0\"\n```\n\nThis is how a minimal application looks like, it listens to your microphone and plays Gemini audio over your speaker:\n\n```scala\nimport cats.effect.{IO, IOApp}\nimport com.alexitc.geminilive4s.GeminiService\nimport com.alexitc.geminilive4s.demo.{MicSource, SpeakerSink}\nimport com.alexitc.geminilive4s.models.{\n  AudioStreamFormat,\n  GeminiConfig,\n  GeminiInputChunk\n}\n\nobject MinimalDemo extends IOApp.Simple {\n  val apiKey = sys.env.getOrElse(\n    \"GEMINI_API_KEY\",\n    throw new RuntimeException(\"GEMINI_API_KEY is required\")\n  )\n\n  val config = GeminiConfig(\n    prompt = \"You are a comedian and your goal is making me laugh\",\n    functions = List.empty\n  )\n\n  override def run: IO[Unit] = {\n    val audioFormat = AudioStreamFormat.GeminiOutput\n    val pipeline = for {\n      gemini \u003c- GeminiService.make(apiKey, config)\n\n      // mic to gemini, gemini to speaker\n      _ \u003c- MicSource\n        .stream(audioFormat)\n        .map(bytes =\u003e GeminiInputChunk(bytes))\n        .through(gemini.conversationPipe(geminiMustSpeakFirst = true))\n        .observe(in =\u003e in.map(_.chunk).through(SpeakerSink.pipe(audioFormat)))\n    } yield ()\n\n    pipeline.compile.drain\n  }\n}\n```\n\n\n## Try it\n\nThe simplest way to try this is by picking one of the [examples](./examples/README.md) and run it with [scala-cli](https://scala-cli.virtuslab.org/), like:\n\n- `scala-cli https://raw.githubusercontent.com/AlexITC/geminilive4s/refs/heads/main/examples/NoteTakerDemo.scala`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexitc%2Fgeminilive4s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexitc%2Fgeminilive4s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexitc%2Fgeminilive4s/lists"}