Trieve Fern adapter
The easiest way to use Trieve in combination with Fern.
Collect all the data
Trieve
You need to retrieve your Org ID
and a new API Key
:
- Go to the Trieve dashboard.
- Copy the
Org ID
, you will need it later. - Press on the
API Keys
tab. - Press
Create New Key
and select OWNER
for the permission. - Copy the
API Key
, you will need it later.
Documents
You need:
- the path to your
<docs.yml>
, e.g. ./fern/docs.yml
. - (optional): the url to your
<openapi.json>
, e.g. https://api.vapi.ai/api-json
. - (optional): the
<root url>
to your docs, e.g. https://docs.vapi.ai
. - (optional): the
<api-reference-path>
, e.g. api-reference
.
Local Setup
Installation
npm install -g trieve-fern-adapter
Environment
You need these environment variables set:
TRIEVE_API_HOST=https://api.trieve.ai
TRIEVE_API_KEY=
TRIEVE_ORGANIZATION_ID=
TRIEVE_DATASET_TRACKING_ID=
The TRIEVE_DATASET_TRACKING_ID
must be an unique identifier for the dataset, e.g. vapi
.
Execution
trieve-fern-adapter --file <docs.yml> -s <openapi.json> -r <root-url> -a <api-reference-page>
CI Setup (GitHub)
Environment
Set these repository secrets:
TRIEVE_API_HOST=https://api.trieve.ai
TRIEVE_API_KEY=
TRIEVE_ORGANIZATION_ID=
TRIEVE_DATASET_TRACKING_ID=
Workflow
Add this workflow to .github/workflows
.
name: Update Trieve
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
on:
push:
branches:
- main
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Trieve Fern Adapter
run: npm install -g trieve-fern-adapter
- name: Update Trieve Chunks
env:
TRIEVE_API_HOST: ${{ secrets.TRIEVE_API_HOST }}
TRIEVE_API_KEY: ${{ secrets.TRIEVE_API_KEY }}
TRIEVE_ORGANIZATION_ID: ${{ secrets.TRIEVE_ORGANIZATION_ID }}
TRIEVE_DATASET_TRACKING_ID: ${{ secrets.TRIEVE_DATASET_TRACKING_ID }}
run: trieve-fern-adapter --file <docs.yml> -s <openapi.json> -r <root-url> -a <api-reference-page>
Replace <docs.yml>
, <openapi.json>
, <root-url>
, and <api-reference-page>
.
License
MIT