{"id":29419847,"url":"https://github.com/print3m/ai-toolkit","last_synced_at":"2025-10-07T11:29:47.453Z","repository":{"id":302316134,"uuid":"1011992860","full_name":"Print3M/ai-toolkit","owner":"Print3M","description":"Simple TS toolkit to work with atomic AI (LLM) tasks.","archived":false,"fork":false,"pushed_at":"2025-07-01T17:12:42.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-01T18:25:33.656Z","etag":null,"topics":["ai","automation","llm","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/Print3M.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-01T16:33:22.000Z","updated_at":"2025-07-01T17:27:33.000Z","dependencies_parsed_at":"2025-07-01T18:38:18.928Z","dependency_job_id":null,"html_url":"https://github.com/Print3M/ai-toolkit","commit_stats":null,"previous_names":["print3m/ai-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Print3M/ai-toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Print3M%2Fai-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Print3M%2Fai-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Print3M%2Fai-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Print3M%2Fai-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Print3M","download_url":"https://codeload.github.com/Print3M/ai-toolkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Print3M%2Fai-toolkit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922908,"owners_count":23683705,"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","automation","llm","typescript"],"created_at":"2025-07-12T01:12:15.540Z","updated_at":"2025-10-07T11:29:42.381Z","avatar_url":"https://github.com/Print3M.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ai-toolkit\n\n**Simple TypeScript toolkit to work with atomic AI (LLM) tasks.**\n\nIt automates the following steps:\n\n1. Initialize AI model (`openai` package) with API key from environs.\n2. Get system and user prompt template.\n3. Inject values into prompt templates (`Nunjucks` template engine).\n4. Send a prompt to AI model.\n5. Get a response from AI model.\n6. Parse the response type-safely.\n7. Validate the parsed response.\n\nThis is the example usage of the toolkit:\n\n```javascript\n    // Define expected data\n    type ReturnedData = {\n        title: string\n        summary: string\n    }\n\n    // Create model\n    const model = new AiModel({\n        apiKeyEnv: \"GEMINI_API_KEY\",\n        model: \"gemini-2.0-flash\",\n        baseUrl: \"https://generativelanguage.googleapis.com/v1beta/openai/\",\n    })\n\n    // Create prompt\n    const prompt = new AiPrompt\u003cReturnedData\u003e({\n        promptTemplates: {\n            system: \"You are world class expert in article summarization.\",\n            user: \"Summary this: {{ title }}, {{ article }}\",\n        },\n        promptParams: {\n            user: {\n                title: \"Hello world!\",\n                article: \"siema\"\n            },\n        },\n        responseParser: (v) =\u003e JSON.parse(v),\n        responseValidator: (v) =\u003e v.title.length \u003e 0,\n    })\n\n    // Create task\n    const task = new AiTask({\n        model,\n        prompt,\n    })\n\n    // Execute task and get result\n    const result = await task.execute()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprint3m%2Fai-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprint3m%2Fai-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprint3m%2Fai-toolkit/lists"}