Skip to content

latitude-dev/typescript-sdk-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wikipedia Article Generator

Wikipedia Article Generator – enter a concept and get a streamed Wikipedia-style article

What is this?

A TypeScript/Node example for how to integrate Latitude into your webapp. This includes the two approaches we advise:

  1. Using Latitude as the gateway: Run your prompts through Latitude.
  2. Using your own provider: Use Latitude as a prompt versioning tool to pull your prompts from, and then wrap your provider calls with Latitude's telemetry package to get traces into Latitude.

How to run it

You need to run both the backend and the frontend, and set the required environment variables.

1. Environment variables (.env):

Create a backend/.env file with:

LATITUDE_API_KEY=your-latitude-api-key
LATITUDE_PROJECT_ID=your-project-id
LATITUDE_PROMPT_PATH=wikipedia-article-generator
LATITUDE_PROMPT_VERSION_UUID=live
OPENAI_API_KEY=your-openai-api-key
USE_LATITUDE_GATEWAY=false

2. Backend

From the repo root:

cd backend
pnpm install
pnpm dev

API runs at http://localhost:8000.
Stream endpoint: POST /generate-wikipedia-article with JSON body {"input": "Concept name"}.

3. Frontend

In another terminal:

cd frontend
pnpm install
pnpm run dev

App runs at http://localhost:5173. Open it in a browser, enter a concept, and click Generate article.


Project structure

  • backend/ – Node app, Latitude SDK, and streaming logic (gateway + telemetry).
  • frontend/ – React + Vite UI; input form and markdown article display.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published