{"_id":"@atmus/nestjs-cache","name":"@atmus/nestjs-cache","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@atmus/nestjs-cache","version":"0.1.0","description":"NestJS - Redis Cache 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","redis","cache","nestjs-cache"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-cache.git"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-cache"},"peerDependencies":{"@nestjs/common":"^10.0.0","rxjs":"^7.2.0"},"dependencies":{"ioredis":"^5.3.2","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"}},"types":"./dist/index.d.ts","homepage":"https://github.com/atmus-tecnologia/nestjs-cache#readme","_id":"@atmus/nestjs-cache@0.1.0","gitHead":"4c6a81b5e4559cb50f3d8d724102ce91c80655ce","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-Kms2bdUPCuyd5yw8O8IqTugLl9w6myvUphOv3NUtSN66DvIpUm52XPGMkbRLmUoUK/F+QRK306DyE/mkxOWp0A==","shasum":"2fe78247051e9d98f744f933c6e4add1238f8075","tarball":"https://registry.npmjs.org/@atmus/nestjs-cache/-/nestjs-cache-0.1.0.tgz","fileCount":15,"unpackedSize":15037,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDARmM/nUE7t3DCDL8UFFfTrFGl1eZ+bK1wj0ejOgs5BwIgU0TVr8nbNUvzmfRZ3B45SHMsD7cEwqu2CcYE+nlKX6I="}]},"_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-cache_0.1.0_1705352055099_0.43112477014167494"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-15T20:54:14.943Z","0.1.0":"2024-01-15T20:54:15.256Z","modified":"2024-01-15T20:54:15.514Z"},"maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"description":"NestJS - Redis Cache integration","homepage":"https://github.com/atmus-tecnologia/nestjs-cache#readme","keywords":["nestjs","redis","cache","nestjs-cache"],"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-cache.git"},"author":{"name":"Felipe Medeiros","email":"medeiros.dev@gmail.com"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-cache"},"license":"MIT","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"}