profile

Hi! I'm Josh.

Want To Build (open source) Stuff With AI Using TypeScript?

Published 11 months ago • 2 min read

Hi! Isn't the intro to a newsletter trying to be all personal always so awkward? Maybe that's just me. Anyway, I wrote some posts about building stuff with AI, using TypeScript and started working on an open-source app with it.

🌱Why LangChain?

Last summer I started playing with HuggingFace, but was super busy with actual work to write Python for a side project, since I don't really know Python. Then I started actually building stuff with the openai-php client, including the API server for my AI-assisted writing plugin UFOAI. Having a PHP client that plays very nice with Laravel allowed me to build stuff into the UFOAI api server besides generating text from a prompt. For example, fixing spelling mistakes or translating text. That's all done with one API call to OpenAI's API.

That's neat, but stuff like chat bots trained on a company's documentation or autonomous-ish agents like AutoGPT require more than a single API call. I also don't want to be totally dependent on OpenAI. So I want to work with a framework that papers over a lot of that complexity, and has tons of integrations.

That led me to LangChain, which works with OpenAI, HuggingFace and others. LangChain is a tool for data-based, AI-powered apps. It has data loaders from all different sources that you can use to index data. Then using those indexes, you can create chains that are composed into agents. An example of an agent is a chat bot, that has access to chains that can search through company documentation.

LangChain started as a Python library, and now has a TypeScript version. I wrote a quick introduction to writing a Node script, using LangChain. I also created a Github template that is explained in the post. The template uses tsup, which is the simplest and fastest TypesScript build tool I've used, besides NextJs.

twitter profile avatar
topher1kenobe
Twitter Logo
@topher1kenobe
On the #WPPhotos project @Josh412 got image 7000! #WordPress wordpress.org/photos/photo/6…
link visual
6856430185
Yellow tulips that have not opened up yet, looking down from the top.
wordpress.org
April 8th 2023
1
Retweets
4
Likes

🌵 LangChain With TypeScript

I really like NextJS and have worked on a few headless WordPress sites that used it for a front-end. The latest version, has a new app directory with a new implementation of their file-system based routing. Recently LangChain added support for additional runtimes besides Node. That made it easy to integrate with NextJS, which I hadn't been able to figure out before.

So, because Josh, I used this as an excuse to learn the new stuff in NextJS. I wrote a post explaining how to get started with LangChain and NextJS. I also started re-writing the UFOAI API server with Next and LangChain. My plan for this was always to open source the API server so they can run their own instance.

Anyway, the code is on Github, here is the plan I'm working from. ​ If you want to contribute, let me know by reply to this email or reply to that thread on Twitter or DM me on Mastodon.​

twitter profile avatar
Josh Pollock 🌱🌵🌲
Twitter Logo
@Josh412
April 19th 2023
0
Retweets
0
Likes

🌲 Random Photos

I wish that Mastodon embeds worked in ConvertKit. I schedule the gm toots on Mastodon, using the app, I need to figure out how to repeat them to Twitter. Anyway here are some random photos:

​These cool pink flowers started blooming in my backyard.​

​Lilacs blooming on Lilac St.​

​Yellow Tulips that won the WordPress Photos 7000th Photo Prize.​

​

🌱🌵🌲,

Josh

​

Hi! I'm Josh.

Josh Pollock

I write a newsletter about PHP and JavaScript development with WordPress, Laravel and React

Read more from Hi! I'm Josh.

🌱I Pressed The Published Button Last week I sent y'all a message about my upcoming Refactoring WordPress Plugins. I uploaded A version 1.0.0 and pressed publish on everything after finishing up work today. i wanted these books to be useful but also fun. I have been working on this eBook and rebuilding the website as a side project for a while now. I've also been working a lot less. I'm also walking the dog more and the book contains photos of flowers and my dog. I hope if you choose to read...

10 months ago • 1 min read

👋 Hi Everyone. I'm back from my time off and have some new stuff ready to go. Earlier this year I wrote about my plans to pivot Plugin Machine. The two big new ideas that I talked about were mini-courses or eBooks and a membership. The first eBook I wrote was soft-launched this week. It is completed and on sale on my site. I am still tweaking things and will announce and publish it on Gumroad next week. You can purchase this book standalone or as part of a site membership. I will be...

10 months ago • 1 min read

🌱 Stuff I've Written Recently Using React's useEffect In WordPress In the last newsletter, I mentioned a post about creating reusable React hooks. Since then I wrote a new post about how to use the useEffect hook in WordPress. This post has several examples of using that hook -- to load WordPress posts via API and to remove admin notices from wp-admin. I also explained how to use the hook to manage pagination, as an example of how the dependencies argument works. I would appreciate if you...

12 months ago • 1 min read
Share this post