{"_id":"@crossingminds/ragsys-sdk","_rev":"5-3b4eac5d1304bf55bff559849f05b396","name":"@crossingminds/ragsys-sdk","dist-tags":{"latest":"0.2.2"},"versions":{"0.0.0":{"name":"@crossingminds/ragsys-sdk","version":"0.0.0","_id":"@crossingminds/ragsys-sdk@0.0.0","maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"dist":{"shasum":"df9f70e7e2848d77998685296f8ceb2615389c18","tarball":"https://registry.npmjs.org/@crossingminds/ragsys-sdk/-/ragsys-sdk-0.0.0.tgz","fileCount":84,"integrity":"sha512-m47swjv+9P7WlsNQwcX1oCL2Wwy4+W9+bok5nSnDKRffccYgo4caqozW/0bVHr3y3pfcvBTndfAF0HBFQ+q5Kw==","signatures":[{"sig":"MEYCIQCTj/aRqzHkv41X+tMvhAxkLYYKuPrkpjsQF6jpbNlxKQIhAND6ulQxP6s91zN6gSwm/mSk0BO0YEtKPJM1L6Dc3vqR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":305014},"main":"./dist/index.mjs","type":"module","_from":"file:crossingminds-ragsys-sdk-0.0.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts $(find src -name \"*.test.ts\")","build":"pnpm preflight && pnpm build-types && pnpm test && pnpm build-esm && pnpm build-cjs","dev-esm":"pnpm build-esm --watch","build-cjs":"esbuild ./src --platform=node --bundle --target=es2022 --format=cjs --sourcemap=external --packages=external --outfile=./dist/index.cjs","build-esm":"esbuild ./src --platform=node --bundle --target=es2022 --format=esm --sourcemap=external --packages=external --metafile=meta.json --outfile=./dist/index.mjs","preflight":"eslint ./src/** && unimported && ts-unused-exports ./tsconfig.json --excludePathsFromReport\"=src/index.ts;src/generatedAPITypes/index.ts\" && cspell --no-cache --no-progress './src/**/*.{ts,tsx}'","test-file":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts","build-types":"tsc","watch-types":"tsc --watch","ci-cd-release":"../../node_modules/@xminds/ship-it-or-skip-it/bin/index.js","test-file-no-mock":"node --loader ts-node/esm --test --experimental-specifier-resolution=node","generate-api-types":"esbuild ./scripts/generateOpenAPITypes.ts --format=esm | node --input-type=module -"},"_npmUser":{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"},"_resolved":"/tmp/3ed6ac272b7da041eda35fa8d9fec765/crossingminds-ragsys-sdk-0.0.0.tgz","_integrity":"sha512-m47swjv+9P7WlsNQwcX1oCL2Wwy4+W9+bok5nSnDKRffccYgo4caqozW/0bVHr3y3pfcvBTndfAF0HBFQ+q5Kw==","_npmVersion":"10.2.3","description":"Crossing Minds RAGSys API Client Library and SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.10.0","dependencies":{"openapi-fetch":"^0.13.4","@crossingminds/utils":"0.7.0","openapi-typescript-helpers":"^0.0.15"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.7.0","cspell":"^6.12.0","eslint":"^8.54.0","esbuild":"^0.17.5","nodemon":"^3.1.4","ts-node":"^10.9.2","typescript":"^5.5.2","unimported":"^1.24.0","@types/node":"^20.11.24","ts-unused-exports":"^9.0.2","openapi-typescript":"^7.6.0","@crossingminds/tsconfig":"0.1.8","@crossingminds/eslint-config":"0.3.10"},"_npmOperationalInternal":{"tmp":"tmp/ragsys-sdk_0.0.0_1738869723857_0.9286028733707401","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@crossingminds/ragsys-sdk","version":"0.1.0","_id":"@crossingminds/ragsys-sdk@0.1.0","maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"dist":{"shasum":"e3879741e65fe16ad7110dfec302f6927ac6cbeb","tarball":"https://registry.npmjs.org/@crossingminds/ragsys-sdk/-/ragsys-sdk-0.1.0.tgz","fileCount":85,"integrity":"sha512-4P5UJdFWB4YVcP7pe0irfQNUmizmgYM0b2fCD1KnyrKUoU5TQJSOtW7io7/2124IZZ8Ghv+dauM0FjHTEGfgAw==","signatures":[{"sig":"MEYCIQCq1B9GPOkzyFh4utiGD6CYyslL45qTVdaC+1/eNdNLqwIhAKo9jBrRSoW0lGbkpDjzvJHQ/EK8X77CtxgfATPireNm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":305125},"main":"./dist/index.mjs","type":"module","_from":"file:crossingminds-ragsys-sdk-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts $(find src -name \"*.test.ts\")","build":"pnpm preflight && pnpm build-types && pnpm test && pnpm build-esm && pnpm build-cjs","dev-esm":"pnpm build-esm --watch","build-cjs":"esbuild ./src --platform=node --bundle --target=es2022 --format=cjs --sourcemap=external --packages=external --outfile=./dist/index.cjs","build-esm":"esbuild ./src --platform=node --bundle --target=es2022 --format=esm --sourcemap=external --packages=external --metafile=meta.json --outfile=./dist/index.mjs","preflight":"eslint ./src/** && unimported && ts-unused-exports ./tsconfig.json --excludePathsFromReport\"=src/index.ts;src/generatedAPITypes/index.ts\" && cspell --no-cache --no-progress './src/**/*.{ts,tsx}'","test-file":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts","build-types":"tsc","watch-types":"tsc --watch","ci-cd-release":"../../node_modules/@xminds/ship-it-or-skip-it/bin/index.js","test-file-no-mock":"node --loader ts-node/esm --test --experimental-specifier-resolution=node","generate-api-types":"esbuild ./scripts/generateOpenAPITypes.ts --format=esm | node --input-type=module -"},"_npmUser":{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"},"_resolved":"/tmp/fe087f247f21b21b5b6a5ecdc11a2c3e/crossingminds-ragsys-sdk-0.1.0.tgz","_integrity":"sha512-4P5UJdFWB4YVcP7pe0irfQNUmizmgYM0b2fCD1KnyrKUoU5TQJSOtW7io7/2124IZZ8Ghv+dauM0FjHTEGfgAw==","_npmVersion":"10.2.3","description":"Crossing Minds RAGSys API Client Library and SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.10.0","dependencies":{"openapi-fetch":"^0.13.4","@crossingminds/utils":"0.7.0","openapi-typescript-helpers":"^0.0.15"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.7.0","cspell":"^6.12.0","eslint":"^8.54.0","esbuild":"^0.17.5","nodemon":"^3.1.4","ts-node":"^10.9.2","typescript":"^5.5.2","unimported":"^1.24.0","@types/node":"^20.11.24","ts-unused-exports":"^9.0.2","openapi-typescript":"^7.6.0","@crossingminds/tsconfig":"0.1.8","@crossingminds/eslint-config":"0.3.10"},"_npmOperationalInternal":{"tmp":"tmp/ragsys-sdk_0.1.0_1738872021766_0.9508000931328024","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@crossingminds/ragsys-sdk","version":"0.2.0","_id":"@crossingminds/ragsys-sdk@0.2.0","maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"dist":{"shasum":"eff07297eeda74ddc01047dc6b15e8d6f48983e5","tarball":"https://registry.npmjs.org/@crossingminds/ragsys-sdk/-/ragsys-sdk-0.2.0.tgz","fileCount":90,"integrity":"sha512-NHNDMlzXZ+/IFiBU7wmffr4mQK+IRdsZgkkQVAICq+PWnL18lwo8VIOz9AzwjoSrjeBWhjh0TNnl8CoU3kNi5A==","signatures":[{"sig":"MEUCIQDpuMRAJmP76GEtUNwvjxVm5swatNtO+BqXKOEvyuXtvgIgHEDiVd+Ft0mhLwnZ+CxAgVN+Vlyh/5jhA3IzU+wwlL4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":333600},"main":"./dist/index.mjs","type":"module","_from":"file:crossingminds-ragsys-sdk-0.2.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts $(find src -name \"*.test.ts\")","build":"pnpm preflight && pnpm build-types && pnpm test && pnpm build-esm && pnpm build-cjs","dev-esm":"pnpm build-esm --watch","build-cjs":"esbuild ./src --platform=node --bundle --target=es2022 --format=cjs --sourcemap=external --packages=external --outfile=./dist/index.cjs","build-esm":"esbuild ./src --platform=node --bundle --target=es2022 --format=esm --sourcemap=external --packages=external --metafile=meta.json --outfile=./dist/index.mjs","preflight":"eslint ./src/** && unimported && ts-unused-exports ./tsconfig.json --excludePathsFromReport\"=src/index.ts;src/generatedAPITypes/index.ts\" && cspell --no-cache --no-progress './src/**/*.{ts,tsx}'","test-file":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts","build-types":"tsc","watch-types":"tsc --watch","ci-cd-release":"../../node_modules/@xminds/ship-it-or-skip-it/bin/index.js","test-file-no-mock":"node --loader ts-node/esm --test --experimental-specifier-resolution=node","generate-api-types":"esbuild ./scripts/generateOpenAPITypes.ts --format=esm | node --input-type=module -"},"_npmUser":{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"},"_resolved":"/tmp/b0572b03aed1264c2f86128a82bef3cb/crossingminds-ragsys-sdk-0.2.0.tgz","_integrity":"sha512-NHNDMlzXZ+/IFiBU7wmffr4mQK+IRdsZgkkQVAICq+PWnL18lwo8VIOz9AzwjoSrjeBWhjh0TNnl8CoU3kNi5A==","_npmVersion":"10.2.3","description":"Crossing Minds RAGSys API Client Library and SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.10.0","dependencies":{"openapi-fetch":"^0.13.4","@crossingminds/utils":"0.7.0","openapi-typescript-helpers":"^0.0.15"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.7.0","cspell":"^6.12.0","eslint":"^8.54.0","esbuild":"^0.17.5","nodemon":"^3.1.4","ts-node":"^10.9.2","typescript":"^5.5.2","unimported":"^1.24.0","@types/node":"^20.11.24","ts-unused-exports":"^9.0.2","openapi-typescript":"^7.6.0","@crossingminds/tsconfig":"0.2.0","@crossingminds/eslint-config":"0.3.10"},"_npmOperationalInternal":{"tmp":"tmp/ragsys-sdk_0.2.0_1741378393973_0.8664190910821421","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@crossingminds/ragsys-sdk","version":"0.2.1","_id":"@crossingminds/ragsys-sdk@0.2.1","maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"dist":{"shasum":"cd6a651d9d6c7e3dcbd0480e7d596cbfb4bf2b15","tarball":"https://registry.npmjs.org/@crossingminds/ragsys-sdk/-/ragsys-sdk-0.2.1.tgz","fileCount":90,"integrity":"sha512-6xmyLY3pLZolegnDWGfjankDs5H0AE1xljBiCyrefiO4ku7g5VZ808JpUi7jaj9fAzFqF11F9QD75zlhuEEDCw==","signatures":[{"sig":"MEYCIQCoUVQ3dzfbl506Mb2MFSiSyy0in4N5lUWRbFa2veA4zgIhAL+N/za5ULpFKeISUo5gO1EwcHDOVqrh3bGbivjxkGvf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":349726},"main":"./dist/index.mjs","type":"module","_from":"file:crossingminds-ragsys-sdk-0.2.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"test":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts $(find src -name \"*.test.ts\")","build":"pnpm preflight && pnpm build-types && pnpm test && pnpm build-esm && pnpm build-cjs","dev-esm":"pnpm build-esm --watch","build-cjs":"esbuild ./src --platform=node --bundle --target=es2022 --format=cjs --sourcemap=external --packages=external --outfile=./dist/index.cjs","build-esm":"esbuild ./src --platform=node --bundle --target=es2022 --format=esm --sourcemap=external --packages=external --metafile=meta.json --outfile=./dist/index.mjs","preflight":"eslint ./src/** && unimported && ts-unused-exports ./tsconfig.json --excludePathsFromReport\"=src/index.ts;src/generatedAPITypes/index.ts\" && cspell --no-cache --no-progress './src/**/*.{ts,tsx}'","test-file":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts","build-types":"tsc","watch-types":"tsc --watch","ci-cd-release":"../../node_modules/@xminds/ship-it-or-skip-it/bin/index.js","test-file-no-mock":"node --loader ts-node/esm --test --experimental-specifier-resolution=node","generate-api-types":"esbuild ./scripts/generateOpenAPITypes.ts --format=esm | node --input-type=module -"},"_npmUser":{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"},"_resolved":"/tmp/c44dd1db8e579bc71f5f847e432ceb37/crossingminds-ragsys-sdk-0.2.1.tgz","_integrity":"sha512-6xmyLY3pLZolegnDWGfjankDs5H0AE1xljBiCyrefiO4ku7g5VZ808JpUi7jaj9fAzFqF11F9QD75zlhuEEDCw==","_npmVersion":"10.2.3","description":"Crossing Minds RAGSys API Client Library and SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.10.0","dependencies":{"openapi-fetch":"^0.13.4","@crossingminds/utils":"0.7.0","openapi-typescript-helpers":"^0.0.15"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.7.0","cspell":"^6.12.0","eslint":"^8.54.0","esbuild":"^0.17.5","nodemon":"^3.1.4","ts-node":"^10.9.2","typescript":"^5.5.2","unimported":"^1.24.0","@types/node":"^20.11.24","ts-unused-exports":"^9.0.2","openapi-typescript":"^7.6.0","@crossingminds/tsconfig":"0.2.0","@crossingminds/eslint-config":"0.3.11"},"_npmOperationalInternal":{"tmp":"tmp/ragsys-sdk_0.2.1_1742581762242_0.6647085901587202","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@crossingminds/ragsys-sdk","version":"0.2.2","description":"Crossing Minds RAGSys API Client Library and SDK","main":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"sideEffects":false,"type":"module","dependencies":{"openapi-fetch":"^0.13.4","openapi-typescript-helpers":"^0.0.15","@crossingminds/utils":"0.7.0"},"devDependencies":{"@types/node":"^20.11.24","cspell":"^6.12.0","esbuild":"^0.17.5","eslint":"^8.54.0","msw":"^2.7.0","nodemon":"^3.1.4","openapi-typescript":"^7.6.0","ts-node":"^10.9.2","ts-unused-exports":"^9.0.2","typescript":"^5.5.2","unimported":"^1.24.0","@crossingminds/eslint-config":"0.3.11","@crossingminds/tsconfig":"0.2.0"},"scripts":{"build":"pnpm preflight && pnpm build-types && pnpm test && pnpm build-esm && pnpm build-cjs","build-types":"tsc","build-esm":"esbuild ./src --platform=node --bundle --target=es2022 --format=esm --sourcemap=external --packages=external --metafile=meta.json --outfile=./dist/index.mjs","build-cjs":"esbuild ./src --platform=node --bundle --target=es2022 --format=cjs --sourcemap=external --packages=external --outfile=./dist/index.cjs","preflight":"eslint ./src/** && unimported && ts-unused-exports ./tsconfig.json --excludePathsFromReport\"=src/index.ts;src/generatedAPITypes/index.ts\" && cspell --no-cache --no-progress './src/**/*.{ts,tsx}'","dev-esm":"pnpm build-esm --watch","watch-types":"tsc --watch","generate-api-types":"esbuild ./scripts/generateOpenAPITypes.ts --format=esm | node --input-type=module -","test":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts $(find src -name \"*.test.ts\")","test-file":"node --loader ts-node/esm --test --experimental-specifier-resolution=node --import=./src/test/mockAPI.ts","test-file-no-mock":"node --loader ts-node/esm --test --experimental-specifier-resolution=node","ci-cd-release":"../../node_modules/@xminds/ship-it-or-skip-it/bin/index.js"},"_id":"@crossingminds/ragsys-sdk@0.2.2","_integrity":"sha512-zNdPZA/33MMDX4naolNqgdRHq9mqLLw32rzSkwjpFbf/wvMzfmbwkiS6GTJGesP+TTiX3pMrblWHSjbF2IWZ1Q==","_resolved":"/tmp/33e8ca817be4f1a5dc230c42407f98b4/crossingminds-ragsys-sdk-0.2.2.tgz","_from":"file:crossingminds-ragsys-sdk-0.2.2.tgz","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-zNdPZA/33MMDX4naolNqgdRHq9mqLLw32rzSkwjpFbf/wvMzfmbwkiS6GTJGesP+TTiX3pMrblWHSjbF2IWZ1Q==","shasum":"cba18ecfdc671049d530c82c3a9a461171598de0","tarball":"https://registry.npmjs.org/@crossingminds/ragsys-sdk/-/ragsys-sdk-0.2.2.tgz","fileCount":90,"unpackedSize":369752,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCSXazE03U8p+0+ENUibF5Ndg0sryKgyioTyzC2F5nXcQIgG+RvRBbDYNU2Ls96/wR0gz0itJ6itMeXqCadQSqQ4zI="}]},"_npmUser":{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"},"directories":{},"maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ragsys-sdk_0.2.2_1743432307040_0.9018332044063262"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-06T19:22:03.724Z","modified":"2025-03-31T14:45:07.420Z","0.0.0":"2025-02-06T19:22:04.033Z","0.1.0":"2025-02-06T20:00:21.971Z","0.2.0":"2025-03-07T20:13:14.213Z","0.2.1":"2025-03-21T18:29:22.462Z","0.2.2":"2025-03-31T14:45:07.207Z"},"description":"Crossing Minds RAGSys API Client Library and SDK","maintainers":[{"name":"crossing.minds","email":"contact@crossingminds.com"},{"name":"jesse.gerard","email":"jesse.gerard@crossingminds.com"}],"readme":"# RAGSys SDK\n\nThis library provides tools for using [Crossing Minds's RAGSys AI Retrieval Engine](https://www.crossingminds.com/platform/ml-layer/ragsys-llm-fine-tuning). See the [API documentation](https://ragsys-api.crossingminds.com/redoc) for more information on RAGSys usage.\n\n## Installation\n\n```zsh\nnpm install @crossingminds/ragsys-sdk\n\n# or\n\npnpm add @crossingminds/ragsys-sdk\n```\n\n## Usage\n\n```typescript\nimport {\n  createChatCompletion,\n  initializeNewDatabase,\n  GENERIC_RAGSYS_SYSTEM_PROMPT,\n  type Model,\n} from \"@crossingminds/ragsys-sdk\";\n\n(async () => {\n  /*\n    In order to do retrieval or LLM inference, we need to create a RAGSys database.\n    Databases persist in the RAGSys service, so you'll only need to do this once per set of few-shot examples.\n    */\n  const databaseName = \"capital-letters\";\n\n  /*\n    The SDK provides low-level tools to call individual API endpoints, but it also provides high-level tools to make common workflows easier.\n\n    Here we can use the `initializeNewDatabase` tool to create a new database, add examples to it, and train a retrieval model.\n    */\n  const initializationResult = await initializeNewDatabase({\n    apiKey: YOUR_RAGSYS_API_KEY,\n    databaseName,\n    description: \"A trivial demonstration of capitalizing a single letter\",\n    /*\n      These few-shot examples can be provided to LLMs as ICL (\"in context learning\").\n      `query` is usually an example of a user message, and `response` is the expected LLM response.\n      */\n    examples: [\n      {\n        query: \"a\",\n        response: \"A\",\n      },\n      {\n        query: \"b\",\n        response: \"B\",\n      },\n      {\n        query: \"c\",\n        response: \"C\",\n      },\n    ],\n    onStatusChange: (initializationStatus) => {\n      console.log(\"initializationStatus: \", initializationStatus);\n    },\n  });\n\n  if (initializationResult.error) {\n    console.error(initializationResult.error);\n    throw Error(\"Failed to initialize a new database\");\n  }\n\n  /*\n    Our new RAGSys database has been successfully setup!\n    We're ready to retrieve few-shot examples and generate LLM responses.\n    */\n\n  /*\n    \"chat completion\" means we're going to ask an LLM chat model to generate content.\n    We'll choose to provide it with few-shot examples so it understands how we want it to format its response.\n    */\n  const ragsysResult = await createChatCompletion({\n    apiKey: YOUR_RAGSYS_API_KEY,\n    databaseName,\n    /* There are about 100 different LLMs to choose from. */\n    model: \"openai/gpt-4o-mini\" satisfies Model,\n    messages: [\n      /*\n        The system prompt is where the few-shot examples are provided to the LLM.\n        You can provide your own prompt, or use the generic prompt provided by the RAGSys SDK.\n        */\n      { role: \"system\", content: GENERIC_RAGSYS_SYSTEM_PROMPT },\n      /*\n        Here the user message resembles the `query` properties of our few-shot examples.\n        The LLM should easily be able to understand the response format we're interested in.\n        */\n      { role: \"user\", content: \"z\" },\n    ],\n    /*\n      By specifying `retrieval` options, we're using RAGSys\n      to retrieve the best few-shot examples for the given user message.\n      If `retrieval` is not specified, the LLM will generate a completion without any few-shot examples from the database.\n      */\n    retrieval: {\n      amt: 3,\n    },\n  });\n\n  if (ragsysResult.error) {\n    console.error(ragsysResult.error);\n    throw Error(\"Failed to generate a chat completion\");\n  }\n\n  const generatedMessage = ragsysResult.data.choices[0]?.message.content;\n\n  console.log(generatedMessage); // Output: \"Z\"\n\n  /* That's it! We've done our first chat completion using RAGSys. */\n})();\n```\n\n## Library Exports\n\n### `createChatCompletion`\n\nGenerate content using chat LLM models with optional RAGSys retrieval.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Completion/operation/completion\n\n### `createDatabase`\n\nCreates a new RAGSys database.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Database/operation/create_database\n\n### `createOrUpdateExamples`\n\nCreate or update few-shot examples in a RAGSys database. After creating examples, run `trainRetrievalModel` if this is the first time few-shot examples have been added to this database.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Few-Shot-Example/operation/save_examples\n\n### `getDatabase`\n\nGet basic information about a RAGSys database.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Database/operation/get_database\n\n### `getDatabases` or `getDatabaseIteratively`\n\nGet a list of RAGSys databases.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Database/operation/get_databases\n\n### `getExamples` or `getExamplesIteratively`\n\nGet few-shot examples stored in a RAGSys database.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Few-Shot-Example/operation/get_saved_examples\n\n### `getModels`\n\nGet a list of LLMs (\"Large Language Models\") available for use with chat completion.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Completion/operation/get_models\n\n### `getTask`\n\nGet the status for a RAGSys service task. Use the higher-level `waitForTaskToSettle` to repeatedly poll the API using this function until the task is complete.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Task/operation/get_task\n\n### `retrieveRankedExamples`\n\nRetrieve few-shot examples ranked by relevance based on the given `query`. This function runs the core RAGSys retrieval algorithm without calling an LLM.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Few-Shot-Example/operation/retrieve_ranked_examples\n\n### `trainRetrievalModel`\n\nTrain a the retrieval model for a new RAGSys database. This function only needs to be run once per database: After the first run, the retrieval model will be updated automatically as new data is added. A database must have few-shot examples before training the retrieval model. You can wait for the model to be trained using the `waitForTaskToSettle` method returned by this function.\n\nhttps://ragsys-api.crossingminds.com/redoc#tag/Task/operation/train_retrieval_model\n\n### `initializeNewDatabase`\n\nSetup a new RAGSys database with examples. Combines the createDatabase, createOrUpdateExamples, and trainRetrievalModel commands. This may take several minutes depending on the size and quantity of your examples.\n\n### `waitForTaskToSettle`\n\nPolls the `getTask` API until the specified task is complete. You may not need to use this function directly as it is typically part of the return object of any function that creates a task; including .`trainRetrievalModel` and `createOrUpdateExamples`.\n\n### `GENERIC_RAGSYS_SYSTEM_PROMPT`\n\nA generic system prompt for use with RAGSys retrieval. Includes Jinja template for inserting few-shot examples.\n\n### `STANDARD_FEW_SHOT_EXAMPLE_TEMPLATE`\n\nStandard Jinja template for inserting formatted few-shot examples in a system prompt.\n\n### type `Model`\n\nNames of LLMs available for use by `createChatCompletion`. For the most up-to-date list, use the `getModels` function to get the model names as an array of strings.\n","readmeFilename":"README.md"}