{"_id":"@daydreamsai/genai","_rev":"8-3afcbeadd501d636453ac37631f1e8a9","name":"@daydreamsai/genai","dist-tags":{"latest":"0.3.8"},"versions":{"0.3.7-alpha.3":{"name":"@daydreamsai/genai","version":"0.3.7-alpha.3","_id":"@daydreamsai/genai@0.3.7-alpha.3","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"d0db0a92b43b38f9e58b967b22af10fe939c3dad","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7-alpha.3.tgz","fileCount":3,"integrity":"sha512-lf/6KIplRe+L08NzMIsLdmYQ4QFBCFJxjjMVnhRVcGzOLM7UyyekpQsmUyBrwRn5IqQsHgtt29N175+lJ9Z9Hw==","signatures":[{"sig":"MEUCIQD51w7iqGiutyMC2nO2MVnJmyqY/jXSUm7Y/MAfDMGIVwIgSN6kpPpAgQnzhAvOlqO7kINCFCW9QgBVpkPhz4Qj148=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6384},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"e9f8c5342e007fd268381bdd81d6c13dcfa6e856","scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_npmVersion":"10.1.0","description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","directories":{},"_nodeVersion":"20.9.0","dependencies":{"ai":"catalog:","zod":"catalog:","@daydreamsai/core":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"catalog:","vitest":"catalog:","@types/bun":"latest"},"peerDependencies":{"typescript":"catalog:"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7-alpha.3_1748316504560_0.17728514590435718","host":"s3://npm-registry-packages-npm-production"}},"0.3.7-alpha.4":{"name":"@daydreamsai/genai","version":"0.3.7-alpha.4","_id":"@daydreamsai/genai@0.3.7-alpha.4","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"cf0c9d5e373d2770f4f09e79a8a8fd1f3af21e50","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7-alpha.4.tgz","fileCount":7,"integrity":"sha512-K8FqdpJnEKRHD2M/Fwxjbew9msHBH7neeP6itNKcN1hFe7ZIEkFMRz6MVSQtfBMJuU0oOAPiBeeAzKoxU+a90w==","signatures":[{"sig":"MEQCIGcExFUzP1f9/gbjYSZTEToh67dVmwqryTzScPnSjDCSAiBZnbNYGdYvpVb8kFIWr9vCtxHhX8iUqj6iGf+oNxcnKg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29488},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"3cb37dc4cc84a9eb1c375e52ea13121a32010fb2","scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_npmVersion":"lerna/8.2.2/node@v20.19.1+x64 (linux)","directories":{},"_nodeVersion":"20.19.1","dependencies":{"ai":"catalog:","zod":"catalog:","@daydreamsai/core":"0.3.7-alpha.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"catalog:","vitest":"catalog:","@types/bun":"latest"},"peerDependencies":{"typescript":"catalog:"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7-alpha.4_1748317321277_0.11833095156970597","host":"s3://npm-registry-packages-npm-production"}},"0.3.7-alpha.5":{"name":"@daydreamsai/genai","version":"0.3.7-alpha.5","_id":"@daydreamsai/genai@0.3.7-alpha.5","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"885a459de5e54be0ed45d12d49575eb58dab0433","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7-alpha.5.tgz","fileCount":7,"integrity":"sha512-aDXkjFOQlftSJOqAlI2CsgE24zNhAqGJfzNgN2hFF5LNTn0NZ5xY+9otAnHlK0gsURfwEhBw4PBR35i4py54AQ==","signatures":[{"sig":"MEQCIDOydDOJlIodUxneDL4MmxUXT5pXrEQyU2OmBNmt0Tf1AiAW0/5/rFsEgLH24VrOxLA8nncI21B9t196ID13wX/Hxw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29667},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"9910f6a11a4b10cc56f9120bf1afd20de54f92c8","scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_npmVersion":"lerna/8.2.2/node@v20.19.1+x64 (linux)","directories":{},"_nodeVersion":"20.19.1","dependencies":{"ai":"catalog:","zod":"catalog:","@daydreamsai/core":"0.3.7-alpha.5"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"catalog:","vitest":"catalog:","@types/bun":"latest"},"peerDependencies":{"typescript":"catalog:"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7-alpha.5_1748317961428_0.16399960717275563","host":"s3://npm-registry-packages-npm-production"}},"0.3.7-alpha.6":{"name":"@daydreamsai/genai","version":"0.3.7-alpha.6","_id":"@daydreamsai/genai@0.3.7-alpha.6","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"6337900dae96bad7140db20aff6b557d8a449c1a","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7-alpha.6.tgz","fileCount":6,"integrity":"sha512-PKh+GpY9cekQVmiFwTF6ofwlX54NJveeBTRigDt4TKEZMGUMqY8D9t7xsPB/B8jeSMophTadfjqp8EXSzqpHUw==","signatures":[{"sig":"MEYCIQCauNkT4yQXI4cxNpoKZQAPqNmGMG/+0A3l7EIVzi9V6wIhALwztvT6ZtWeVdHA+DUrhq5ggTPlgw878ywCbnfvdXho","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28715},"main":"./dist/index.js","type":"module","_from":"file:daydreamsai-genai-0.3.7-alpha.6.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_resolved":"/tmp/dec9b481dd72e86442c77f1f9cc5e376/daydreamsai-genai-0.3.7-alpha.6.tgz","_integrity":"sha512-PKh+GpY9cekQVmiFwTF6ofwlX54NJveeBTRigDt4TKEZMGUMqY8D9t7xsPB/B8jeSMophTadfjqp8EXSzqpHUw==","_npmVersion":"10.8.2","description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","directories":{},"_nodeVersion":"20.19.1","dependencies":{"ai":"4.3.16","zod":"3.25.23","@daydreamsai/core":"0.3.7-alpha.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.3.6","vitest":"3.0.5","@types/bun":"latest"},"peerDependencies":{"typescript":"5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7-alpha.6_1748318986447_0.8916694149402167","host":"s3://npm-registry-packages-npm-production"}},"0.3.7-alpha.7":{"name":"@daydreamsai/genai","version":"0.3.7-alpha.7","_id":"@daydreamsai/genai@0.3.7-alpha.7","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"a82c3393a2e1017d5a2eccdcfc93488b535b480a","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7-alpha.7.tgz","fileCount":6,"integrity":"sha512-UDLvFccOw3y3OBfUHQtPtT4B7EmX7+g5LbWQFqVDOXIyAdGDqwc4ENMflCW6uKRAmEw7REmz2oXM8ac3hyx5ag==","signatures":[{"sig":"MEUCIQC3ICj49wymDP40CsSFsmYRhvmTbS3B5NOWzLYGPZMiKgIgCicDzhmJ2kEDKUerDN0i/LTREmqVPx8cEEZkFTWUIHI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31509},"main":"./dist/index.js","type":"module","_from":"file:daydreamsai-genai-0.3.7-alpha.7.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_resolved":"/tmp/8d0ed49e4ed2b43cb226c4b4af05743b/daydreamsai-genai-0.3.7-alpha.7.tgz","_integrity":"sha512-UDLvFccOw3y3OBfUHQtPtT4B7EmX7+g5LbWQFqVDOXIyAdGDqwc4ENMflCW6uKRAmEw7REmz2oXM8ac3hyx5ag==","_npmVersion":"10.8.2","description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","directories":{},"_nodeVersion":"20.19.1","dependencies":{"ai":"4.3.16","zod":"3.25.23","@daydreamsai/core":"0.3.7-alpha.7"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.3.6","vitest":"3.0.5","@types/bun":"latest"},"peerDependencies":{"typescript":"5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7-alpha.7_1748471000542_0.8597264755130372","host":"s3://npm-registry-packages-npm-production"}},"0.3.7":{"name":"@daydreamsai/genai","version":"0.3.7","_id":"@daydreamsai/genai@0.3.7","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"}],"dist":{"shasum":"820c33bcaae6c6564dd82931639ff545b9e3c422","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.7.tgz","fileCount":6,"integrity":"sha512-fsUuuBMvXZk0w3ZnTuJzriMigkK9v1/ZZ4WMfZe9vTpUSBuao3rsh6txrUia7Eqk8z70odS3qZw61buqkpfbxA==","signatures":[{"sig":"MEUCIASTWT6moRY5fJdYew6+769Pjd89whL3P4KyFTng/bsnAiEAgj1LMmeHR4oFrnxVb1Ds6QvNF39b9OwRNasOlMAt+0Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31656},"main":"./dist/index.js","type":"module","_from":"file:daydreamsai-genai-0.3.7.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},"_resolved":"/tmp/638d51d4ad02788e0eb522832d5d5b2d/daydreamsai-genai-0.3.7.tgz","_integrity":"sha512-fsUuuBMvXZk0w3ZnTuJzriMigkK9v1/ZZ4WMfZe9vTpUSBuao3rsh6txrUia7Eqk8z70odS3qZw61buqkpfbxA==","_npmVersion":"10.8.2","description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","directories":{},"_nodeVersion":"20.19.1","dependencies":{"ai":"4.3.16","zod":"3.25.23","@daydreamsai/core":"0.3.7"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.3.6","vitest":"3.0.5","@types/bun":"latest"},"peerDependencies":{"typescript":"5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/genai_0.3.7_1748902667207_0.5737946536268146","host":"s3://npm-registry-packages-npm-production"}},"0.3.8":{"name":"@daydreamsai/genai","version":"0.3.8","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.js"}},"devDependencies":{"@types/bun":"latest","tsup":"8.3.6","vitest":"3.0.5"},"peerDependencies":{"typescript":"5.8.3"},"dependencies":{"ai":"4.3.16","zod":"3.25.23","@daydreamsai/core":"0.3.8"},"scripts":{"test":"vitest","build":"tsup --dts-resolve"},"_id":"@daydreamsai/genai@0.3.8","description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","_integrity":"sha512-cIBu089KYDumlu8t8zvwPtTg6wz/B3uPK1Opka9yamAr4rDBKUDzHY5Goad5p6U48rQUIzvXo6wBny+meVgPYA==","_resolved":"/tmp/48495b8a3f98354ad3a4fbe99c02dbb5/daydreamsai-genai-0.3.8.tgz","_from":"file:daydreamsai-genai-0.3.8.tgz","_nodeVersion":"20.19.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-cIBu089KYDumlu8t8zvwPtTg6wz/B3uPK1Opka9yamAr4rDBKUDzHY5Goad5p6U48rQUIzvXo6wBny+meVgPYA==","shasum":"50c9d8c8c778f744f4ca2f731bca796e83c55fcb","tarball":"https://registry.npmjs.org/@daydreamsai/genai/-/genai-0.3.8.tgz","fileCount":6,"unpackedSize":31811,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDyVRuoYnRetPZfsx9+fnnNe9PyUokuOsQQvQPOteJ4XwIgXgwDVLWiPFcGgVDBEIT3C+5C+FrPoInNg/FRrVLv/KU="}]},"_npmUser":{"name":"realm_lord","email":"realm.lord.eth@gmail.com","actor":{"name":"realm_lord","email":"realm.lord.eth@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},{"name":"bmgalego","email":"bmgalego@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/genai_0.3.8_1750258342706_0.382397213321241"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-27T03:28:24.499Z","modified":"2025-06-18T14:52:23.078Z","0.3.7-alpha.3":"2025-05-27T03:28:24.707Z","0.3.7-alpha.4":"2025-05-27T03:42:01.457Z","0.3.7-alpha.5":"2025-05-27T03:52:41.611Z","0.3.7-alpha.6":"2025-05-27T04:09:46.587Z","0.3.7-alpha.7":"2025-05-28T22:23:20.717Z","0.3.7":"2025-06-02T22:17:47.387Z","0.3.8":"2025-06-18T14:52:22.875Z"},"description":"This package provides a DaydreamsAI SDK extension with general-purpose Generative AI (GenAI) capabilities and actions that can be easily added to any Daydream agent.","maintainers":[{"name":"realm_lord","email":"realm.lord.eth@gmail.com"},{"name":"bmgalego","email":"bmgalego@gmail.com"}],"readme":"# @daydreamsai/genai\n\nThis package provides a DaydreamsAI SDK extension with general-purpose\nGenerative AI (GenAI) capabilities and actions that can be easily added to any\nDaydream agent.\n\n## Overview\n\nThe primary goal of this package is to encapsulate reusable AI functionalities,\nmaking them independent of specific communication channels (like Discord,\nTelegram, Web UI, etc.). By adding this extension to an agent, the agent gains\naccess to these core AI actions.\n\nCommunication-specific extensions (e.g., `@daydreamsai/discord`) are responsible\nfor handling the specifics of their platform and preparing data in a format that\nthese general AI actions can consume.\n\n## Current Features\n\n### Actions\n\n- **`analyzeImage`**:\n\n  - **Description**: Analyzes provided text and accompanying image attachments,\n    then generates a relevant textual response. This action can be used to\n    describe images, answer questions about them, or perform other\n    vision-related tasks.\n  - **Input Schema**:\n    - `text` (string): The text prompt accompanying the image(s).\n    - `attachments` (array of objects, min 1): Image attachments to analyze.\n      Each object should contain:\n      - `url` (string, URL): URL of the image.\n      - `filename` (string, optional): Filename of the image.\n      - `contentType` (string, optional): MIME type of the image (e.g.,\n        `image/jpeg`).\n      - `data` (Buffer, optional): Pre-fetched image data as a Buffer. If\n        provided by an input extension (like `@daydreamsai/discord` with\n        `PROCESS_ATTACHMENTS=true`), this will be used directly, avoiding\n        another fetch.\n  - **How it works**: This action leverages the agent's main configured Language\n    Model (e.g., a Gemini model via `@ai-sdk/google`). It constructs a\n    multimodal prompt with the provided text and image data (either pre-fetched\n    `data` or by fetching the `url`) and uses the AI SDK's `generateText`\n    function to get a response.\n\n- **`analyzeVideo`**:\n  - **Description**: Analyzes provided text and accompanying video attachments,\n    then generates a relevant textual response. This action can be used to\n    describe videos, answer questions about them, summarize content, or perform\n    other video-related tasks.\n  - **Input Schema**:\n    - `text` (string): The text prompt accompanying the video(s).\n    - `attachments` (array of objects, min 1): Video attachments to analyze.\n      Each object should contain:\n      - `url` (string, URL): URL of the video.\n      - `filename` (string, optional): Filename of the video.\n      - `contentType` (string, optional): MIME type of the video (e.g.,\n        `video/mp4`).\n      - `data` (Buffer, optional): Pre-fetched video data as a Buffer. If\n        provided by an input extension, this will be used directly, avoiding\n        another fetch.\n  - **How it works**: Similar to `analyzeImage`, this action uses the agent's\n    main configured Language Model. It constructs a multimodal prompt with the\n    text and video data. The underlying AI SDK (`ai` package) and the language\n    model provider (e.g., `@ai-sdk/google`) are responsible for processing the\n    video content. _Note: The exact capabilities depend on the LLM's support for\n    video understanding._\n\n## Usage\n\n1.  **Installation** (assuming it's part of your monorepo/workspace): Ensure\n    it's correctly set up in your project's package management (e.g., pnpm\n    workspaces).\n\n2.  **Add to Agent Configuration**: In your agent's main setup file (e.g., where\n    you use `createDreams`):\n\n    ```typescript\n    import { createDreams } from \"@daydreamsai/core\";\n    import { genai } from \"@daydreamsai/genai\";\n    import { createGoogleGenerativeAI } from \"@ai-sdk/google\";\n\n    const agent = createDreams({\n      model: createGoogleGenerativeAI({\n        apiKey: env.GEMINI_API_KEY,\n      })(\"gemini-2.5-flash-preview-04-17\"),\n      logger: new Logger({ level: LogLevel.DEBUG }),\n      extensions: [genai],\n    });\n\n    await agent.start();\n    ```\n\n3.  **Invoking Actions**: Once the agent is running with this extension, the\n    Language Model (LLM) can choose to use the `analyzeImage` action when\n    appropriate based on the user's input and the action's description. For\n    instance, if a user on Discord sends a message like \"What is in this\n    picture?\" along with an image, the LLM should be able to identify that the\n    `analyzeImage` action is suitable.\n\n    The input extension (e.g., `@daydreamsai/discord`) is responsible for\n    providing the `text` and `attachments` (ideally with pre-fetched `data` if\n    `PROCESS_ATTACHMENTS=true` is set for the Discord extension) to the agent.\n    The agent's core logic, guided by the LLM, then routes this to the\n    `analyzeImage` action.\n\n## Future Possibilities\n\nThis package can be expanded to include other general AI actions, such as:\n\n- Advanced video analysis.\n- Complex document summarization or Q&A.\n- Voice transcription and analysis (if an input extension provides audio data).\n\nBy keeping these actions in a dedicated `genai` package, they remain reusable\nacross different agent types and communication platforms.\n","readmeFilename":"README.md"}