Skip to content

Latest commit

 

History

History
38 lines (20 loc) · 1.76 KB

add-ai-provider.md

File metadata and controls

38 lines (20 loc) · 1.76 KB

Adding a new AI Provider

Documentation on how to support a new AI provider.

Steps

1. Setup your developer environment

See CONTRIBUTING.

2. Add it to the Config Schema

The aiProvider property in the config schema (lib/schema.ts) needs to be updated to allow for inputting any necessary information for this AI provider (e.g. model name, api key). Don't forget to rebuild the config!

3. Creating the Provider class

Implement the Provider interface (ai-providers/provider.ts) in a file also under ai-providers/ (e.g. ai-providers/open-ai.ts).

Ensure that the askStream response returns a Node.js-builtin ReadableStream that outputs the expected format defined in the REST API docs.

4. Add the provider to the build function in the warp plugin

See plugins/warp.ts build().

5. Add the provider to the generator code

See lib/generator.ts.

6. Unit Tests

Add provider to tests/unit/ai-providers.test.ts.

7. E2E Tests

Add provider config to tests/e2e/api.test.ts.

8. Type Tests

Add the provider config to the schema tests tests/types/schema.test-d.ts.