{"id":15011413,"url":"https://github.com/nanofuxion/buni","last_synced_at":"2025-06-17T21:37:42.198Z","repository":{"id":214879229,"uuid":"737539823","full_name":"nanofuxion/buni","owner":"nanofuxion","description":"Buni is a TypeScript-based client API for Ollama, designed to be simple yet flexible.","archived":false,"fork":false,"pushed_at":"2023-12-31T16:11:20.000Z","size":18,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T22:04:28.378Z","etag":null,"topics":["ai","bun","bunjs","javascript","llama2","module","ollama","ollama-api","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanofuxion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-31T12:45:46.000Z","updated_at":"2025-02-14T20:35:38.000Z","dependencies_parsed_at":"2023-12-31T16:47:15.425Z","dependency_job_id":null,"html_url":"https://github.com/nanofuxion/buni","commit_stats":null,"previous_names":["nanofuxion/buni"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nanofuxion/buni","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanofuxion%2Fbuni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanofuxion%2Fbuni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanofuxion%2Fbuni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanofuxion%2Fbuni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanofuxion","download_url":"https://codeload.github.com/nanofuxion/buni/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanofuxion%2Fbuni/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260443794,"owners_count":23010080,"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":["ai","bun","bunjs","javascript","llama2","module","ollama","ollama-api","typescript"],"created_at":"2024-09-24T19:41:04.016Z","updated_at":"2025-06-17T21:37:37.163Z","avatar_url":"https://github.com/nanofuxion.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Revised README for Buni (Ollama Client Library)\n\n# Buni\n\n## Ollama Client Library (Buni)\n\nBuni is a TypeScript-based client API for Ollama, designed to be simple yet flexible. It is intended for use with the Bun JavaScript runtime. Buni should work in Node.js environments, although this has not been extensively tested.\nWhy did I name it buni? idk just liked the name.\n\n## Installation\n\n```bash\nbun add github:nanofuxion/buni\n```\n\n## Usage\n\n### Creating an Instance\n\nInstantiate `OllamaClient` with an `Options` object to connect to the Ollama server:\n\n```ts\nconst client = new OllamaClient({\n    host: 'ollama_host',\n    port: ollama_port,\n    model: 'model_name', // Ollama model name\n    // Optional parameters\n    template: 'template_name', // Template for Ollama responses\n    system: 'system_name', // System name for additional Ollama configurations\n    config: modelParameters, // Configuration parameters for Ollama model\n    context: contextArray // Context array for Ollama interactions\n});\n```\n\n### Class Properties\n\n- `url`: URL of the Ollama server (constructed from host and port).\n- `model`: Name of the Ollama model.\n- `template` (optional): Template name for Ollama responses.\n- `system` (optional): System name for additional Ollama configurations.\n- `config` (optional): Configuration parameters for the Ollama model.\n- `context` (optional): Context array for Ollama interactions.\n\n### Methods\n\n#### `async connect()`\n\nEstablish a connection to the Ollama server. Returns a text response.\n\n#### `setContext(context: number[])`\n\nUpdate the context for the Ollama interactions.\n\n---\n\n#### `async generate(options)`\n\nGenerate an Ollama response based on provided options, which include `prompt`, `raw`, `config`, `system`, `template`, and `context`.\n\n#### `async stream(options)`\n\nStream data from the Ollama server. Options include `prompt`, `raw`, `config`, `system`, `template`, `context`, and a `getToken` function. This method returns the full response upon stream completion.\n\n---\n\n#### `async chat(options)`\n\nInitiate a non-streaming chat session with Ollama. Options include `messages` and `config`.\n\n#### `async stream_chat(options)`\n\nInitiate a streaming chat session with Ollama. Options include `messages`, `config`, and `getToken`. This method returns the message object upon stream completion.\n\n## Examples\n\n### Connecting to the Server\n\n```ts\nawait client.connect();\n```\n\n### Generating an Ollama Response\n\n```ts\nconst response = await client.generate({\n    prompt: \"Your prompt here\",\n    raw: false,\n    config: yourConfig,\n    system: 'yourSystem',\n    template: 'yourTemplate',\n    context: yourContext\n});\n\nconst streamResponse = await client.stream({\n    prompt: \"Your prompt here\",\n    raw: true,\n    config: yourConfig,\n    system: 'yourSystem',\n    template: 'yourTemplate',\n    context: yourContext,\n    getToken: yourTokenFunction\n});\n```\n\n### Engaging in an Ollama Chat\n\n```ts\nconst chatResponse = await client.chat({\n    messages: yourMessagesArray,\n    config: yourConfig\n});\n\nconst streamedChatResponse = await client.stream_chat({\n    messages: yourMessagesArray,\n    config: yourConfig,\n    getToken: yourTokenFunction\n});\n```\n\n## Contribution\n\nContributions to the Buni Ollama Client Library are welcome. Please ensure that your code aligns with the existing style and includes proper tests and documentation then submit a pull request.\n\n---\n\nNote: This README is based on the `index.ts` file of the Ollama Client Library and may need adjustments to match the actual implementation and use cases of your project. (Readme Partially generated using ChatGPT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanofuxion%2Fbuni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanofuxion%2Fbuni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanofuxion%2Fbuni/lists"}