{"_id":"@atmus/nestjs-openai","_rev":"1-b129a0e017b6680e9997bbb6ac88c7f1","name":"@atmus/nestjs-openai","dist-tags":{"latest":"0.0.2"},"versions":{"0.1.0":{"name":"@atmus/nestjs-openai","version":"0.1.0","keywords":["nestjs","openai","nestjs-openai"],"author":{"name":"Felipe Medeiros","email":"medeiros.dev@gmail.com"},"license":"MIT","_id":"@atmus/nestjs-openai@0.1.0","maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"homepage":"https://github.com/atmus-tecnologia/nestjs-openai#readme","bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-openai"},"dist":{"shasum":"d20156cf8b19a15925e2dc5daf63589f9b2f8920","tarball":"https://registry.npmjs.org/@atmus/nestjs-openai/-/nestjs-openai-0.1.0.tgz","fileCount":15,"integrity":"sha512-a8VgYruyb9g55AplUs/kHp67lOKzvvRxcG+X6050Rq77j7dGgtIGETl/6P8Xb5ciEwsz3Xn/3a9pYMNHpwrlEw==","signatures":[{"sig":"MEQCIBNvwmWlxVH3ONIJX6Yl+Squ5WcWeuLQLtaFOuXBa2XNAiAMmYlRFVHhvMOph+9W6M2JdQ2ySvKxmZg9zuV4kAGsFg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11913},"jest":{"roots":["src"],"testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","moduleNameMapper":{"src/(.*)":"<rootDir>/src/$1"},"coverageDirectory":"../coverage","moduleDirectories":["node_modules","src"],"collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"63465eca51bd38ef648e55ab4c44576c720a4e9c","scripts":{"test":"jest","build":"nest build","major":"npm run release -- --release-as major","minor":"npm run release -- --release-as minor","patch":"npm run release -- --release-as patch","deploy":"sh ./publish.sh","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","release":"standard-version"},"_npmUser":{"name":"fmedeiros","email":"medeiros.dev@gmail.com"},"precommit":["format","test"],"repository":{"url":"git+https://github.com/atmus-tecnologia/nestjs-openai.git","type":"git"},"_npmVersion":"10.2.4","description":"NestJS - OpenAI integration","directories":{},"_nodeVersion":"20.11.0","dependencies":{"rxjs":"^7.2.0","openai":"^4.24.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","rxjs":"^7.2.0","husky":"^8.0.3","rimraf":"^4.4.1","tslint":"^6.1.3","ts-jest":"^29.0.5","ts-node":"^10.9.1","prettier":"^2.8.7","typescript":"^5.0.2","@types/jest":"^29.5.0","@types/node":"^20.3.1","lint-staged":"^13.2.0","@nestjs/core":"^10.0.0","@nestjs/common":"^10.0.0","@nestjs/testing":"^10.0.0","reflect-metadata":"^0.1.13","standard-version":"^9.5.0","@typescript-eslint/parser":"^5.57.0","@typescript-eslint/eslint-plugin":"^5.57.0"},"peerDependencies":{"rxjs":"^7.2.0","@nestjs/common":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-openai_0.1.0_1705349829474_0.7806033232335898","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@atmus/nestjs-openai","version":"0.0.2","description":"NestJS - OpenAI integration","author":{"name":"Felipe Medeiros","email":"medeiros.dev@gmail.com"},"license":"MIT","main":"dist/index.js","scripts":{"build":"nest build","deploy":"sh ./publish.sh","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","major":"npm run release -- --release-as major","minor":"npm run release -- --release-as minor","patch":"npm run release -- --release-as patch","release":"standard-version","test":"jest"},"precommit":["format","test"],"keywords":["nestjs","openai","nestjs-openai"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-openai.git"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-openai"},"peerDependencies":{"@nestjs/common":"^10.0.0","rxjs":"^7.2.0"},"dependencies":{"openai":"^4.57.0","rxjs":"^7.2.0"},"devDependencies":{"@nestjs/common":"^10.0.0","@nestjs/core":"^10.0.0","@nestjs/testing":"^10.0.0","@types/jest":"^29.5.0","@types/node":"^20.3.1","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","husky":"^8.0.3","jest":"^29.5.0","lint-staged":"^13.2.0","prettier":"^2.8.7","reflect-metadata":"^0.1.13","rimraf":"^4.4.1","rxjs":"^7.2.0","standard-version":"^9.5.0","ts-jest":"^29.0.5","ts-node":"^10.9.1","tslint":"^6.1.3","typescript":"^5.0.2"},"jest":{"moduleDirectories":["node_modules","src"],"moduleFileExtensions":["js","json","ts"],"roots":["src"],"testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"collectCoverageFrom":["**/*.(t|j)s"],"coverageDirectory":"../coverage","testEnvironment":"node","moduleNameMapper":{"src/(.*)":"<rootDir>/src/$1"}},"_id":"@atmus/nestjs-openai@0.0.2","gitHead":"95070997d7079d553af95d1dd7ab0cf9317644ca","types":"./dist/index.d.ts","homepage":"https://github.com/atmus-tecnologia/nestjs-openai#readme","_nodeVersion":"20.16.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9cuHXPJe3Bgh7Kh3NIY4h9TZixy2TJ4NlL86/G//1PrydPncX3bA4cmF4t33ydlTEuHtjphDZPzqONLweaJVGg==","shasum":"ee4a768b03386a771da37279a8f6ea2b2f50b43f","tarball":"https://registry.npmjs.org/@atmus/nestjs-openai/-/nestjs-openai-0.0.2.tgz","fileCount":14,"unpackedSize":11612,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH5hnJ670jZ6LeaiEa9/wt93pTPzDGmAgEji4JLt5yYbAiEAomGHZXymGssCWSz2n+wws1fSW3reppQS6UW1SjaCyVo="}]},"_npmUser":{"name":"fmedeiros","email":"medeiros.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-openai_0.0.2_1725002526132_0.8258248855719466"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-15T20:17:09.291Z","modified":"2024-08-30T07:22:06.589Z","0.1.0":"2024-01-15T20:17:09.686Z","0.0.2":"2024-08-30T07:22:06.402Z"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-openai"},"author":{"name":"Felipe Medeiros","email":"medeiros.dev@gmail.com"},"license":"MIT","homepage":"https://github.com/atmus-tecnologia/nestjs-openai#readme","keywords":["nestjs","openai","nestjs-openai"],"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-openai.git"},"description":"NestJS - OpenAI integration","maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"readme":"<h1 align=\"center\"></h1>\n\n<div align=\"center\">\n  <a href=\"http://nestjs.com/\" target=\"_blank\">\n    <img src=\"https://nestjs.com/img/logo_text.svg\" width=\"150\" alt=\"Nest Logo\" />\n  </a>\n</div>\n\n<h3 align=\"center\">NestJS OpenAI</h3>\n\n---\n\n# Features\n\n- Configure and inject the OpenAI API client.\n\n# Installation\n\n```\nyarn add @atmus/nestjs-openai\n```\n\n# Usage\n\n## Settings\n\n### `OpenAIModule.register`\n\nImport the module at your module. Configure the OpenAI API client.\n\n```typescript\nimport { OpenAIModule } from \"@atmus/nestjs-openai\";\n\n@Module({\n  imports: [\n    OpenAIModule.register({\n      apiKey: \"sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    }),\n  ],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n### `OpenAIModule.registerAsync`\n\nYou can also use `OpenAIModule.registerAsync` to configure it asynchronously.\nThis way you can hide your api key from the code. It's recommended to use this method.\n\n```typescript\nimport { OpenAIModule } from \"@atmus/nestjs-openai\";\n\n@Module({\n  imports: [\n    OpenAIModule.registerAsync({\n      useFactory: (config: ConfigService<EnvVars>) => ({\n        apiKey: config.get(\"OPENAI_API_KEY\"),\n      }),\n      inject: [ConfigService],\n    }),\n  ],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n## Inject `OpenAIService`\n\nInject `OpenAIService` anywhere. Injected service is identical to OpenAI API client.\n\n```typescript\n@Injectable()\nexport class TextCompletionService {\n  constructor(private readonly openai: OpenAIService) {}\n\n  async completion(\n    messages: CreateChatCompletionRequest[\"messages\"],\n  ): Promise<string> {\n    const { data } = await this.openai.createCompletion({\n      model: \"davinci\",\n      prompt: \"This is a test\",\n    });\n    return data.choices[0].text;\n  }\n}\n```\n","readmeFilename":"README.md"}