diff --git a/.env.example b/.env.example index bff4b1c..93ddacc 100644 --- a/.env.example +++ b/.env.example @@ -6,3 +6,6 @@ # ------------------------------------------------------------------------------ OPENAI_API_KEY= + +# required for running tests +#REDIS_URL_TEST= diff --git a/package.json b/package.json index b702ddc..a2020a4 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "ky": "^0.33.3", "openai-fetch": "^1.5.0", "p-map": "^6.0.0", + "p-timeout": "^6.1.1", "quick-lru": "^6.1.1", "ts-dedent": "^2.2.0", "zod": "^3.21.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6cd041..bad566f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,6 +19,9 @@ dependencies: p-map: specifier: ^6.0.0 version: 6.0.0 + p-timeout: + specifier: ^6.1.1 + version: 6.1.1 quick-lru: specifier: ^6.1.1 version: 6.1.1 @@ -2378,6 +2381,11 @@ packages: engines: {node: '>=12'} dev: true + /p-timeout@6.1.1: + resolution: {integrity: sha512-yqz2Wi4fiFRpMmK0L2pGAU49naSUaP23fFIQL2Y6YT+qDGPoFwpvgQM/wzc6F8JoenUkIlAFa4Ql7NguXBxI7w==} + engines: {node: '>=14.16'} + dev: false + /parse-json@4.0.0: resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} engines: {node: '>=4'} diff --git a/readme.md b/readme.md index 7d8cb89..cd40499 100644 --- a/readme.md +++ b/readme.md @@ -5,59 +5,56 @@
+- [Intro](#intro) +- [Development](#development) + - [Environment](#environment) + - [Local Testing](#local-testing) +- [License](#license) + ## Intro TODO -## TODO +## Development -https://github.com/colinhacks/zod#writing-generic-functions +- [node](https://nodejs.org/en) >= 18 +- [pnpm](https://pnpm.io) >= 8 -## Use Cases +```bash +pnpm install +``` -https://platform.openai.com/examples +### Environment -- text completion - - text generation - - text classification - - https://platform.openai.com/docs/guides/completion/classification - - https://docs.cohere.com/docs/text-classification-with-classify - - special cases - - content moderation - - https://platform.openai.com/docs/guides/moderation/overview - - language detection - - conversation - - transformation - - translation - - conversion - - summarization - - completion - - factual responses -- chat completion -- entity extraction -- reranking +```bash +cp .env.example .env +``` -// take in a query and a list of texts and produces an ordered array with each text assigned a relevance score. -// generate JSON conforming to a zod schema -// generate a string conforming to a zod schema -// generate TS code and ensure it is valid syntax + valid exports -// generate HTML and ensure it parses correctly -// primitives (boolean, number, z.coerce.date, string) -// classifier (enum) -// CSV +**Required** -// retry strategies +- `OPENAI_API_KEY` - OpenAI API key. +- `REDIS_URL_TEST` - Redis server URL used for caching third-party API calls during testing. -// separate the prompt formatting from the inference call? +**Optional** + +- `ANTHROPIC_API_KEY` - [Anthropic](https://www.anthropic.com) API key ([docs](https://console.anthropic.com/docs)) +- `SERP_API_KEY` - [SerpApi](https://serpapi.com) API key ([docs](https://serpapi.com/search-api)) +- `METAPHOR_API_KEY` - [Metaphor](https://metaphor.systems) API key ([docs](https://metaphorapi.readme.io/)) + +### Local Testing + +Ensure you have `REDIS_URL_TEST` set to a valid redis connection URL. + +```bash +pnpm test +``` ## License MIT © [Travis Fischer](https://transitivebullsh.it) - -If you found this project interesting, please consider [sponsoring me](https://github.com/sponsors/transitive-bullshit) or following me on twitter