tomtomau / brisphp-llm-demos

Source code for BrisPHP presentation on LLMs

Repository from Github https://github.comtomtomau/brisphp-llm-demosRepository from Github https://github.comtomtomau/brisphp-llm-demos

BrisPHP LLM Talk

ChatGPT is cool, but how do we go about actually developing something that could make it's way to production?

This repo provides scripts that iteratively build upon each other to build an HTTP API that can receive an input recipe name and it returns the most relevant category using an LLM.

Prerequisites

Copy the .env.dist to create .env and fill in the required values.

cp .env.dist .env

You will need to have an OpenAI API key and a LangSmith API Key:

  • OpenAI lets you top up with credits and pay as you go (min $5)
  • LangSmith has a generous free tier

Setup

(Optional): Use Node version 20 with nvm

nvm use

Install dependencies

npm install

Running the scripts:

npm run 1 # This is a simple hello world script
npm run 2 # This prototypes calling the API with a recipe name
npm run 3 # This demonstrates how to receive structured output
npm run 4 # This shows how to use LangSmith to iterate
npm run 5 # This runs a HTTP API on port 3000
npm run 5-experiment # This runs an experiment using the same chain from the API

Disclaimer

This code is not ready for production :) please don't ship the API 😅

Show me what you build!

I'd love to hear if you build something cool as a result of my talk or this repo (regardless of whether it gets to production!)

Send me a message on LinkedIn to say G'day!

Further resources:

About

Source code for BrisPHP presentation on LLMs

License:Other


Languages

Language:TypeScript 100.0%