AI.JSX

The AI Application Framework for Javascript
GitHub
1.08k
Created 2 years ago, last commit 7 months ago
15 contributors
594 commits
Stars added on GitHub, month by month
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
Stars added on GitHub, per day, on average
Yesterday
=
Last week
0.0
/day
Last month
+0.7
/day
Last 12 months
+0.8
/day
npmPackage on NPM
ai-jsx
0.33.1
Monthly downloads on NPM
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
README

AI.JSX — The AI Application Framework for Javascript

Docs Site Discord Follow Twitter Follow

About AI.JSX

AI.JSX is a framework for building AI applications using Javascript and JSX. With AI.JSX, you get great tools for prompt engineering and can have the LLM render React components in its response (instead of only text). This means you can provide a set of React components and let the LLM construct your UI dynamically at runtime. AI.JSX also provides native support for tools, Document Question & Answering, and much more.

AI.JSX can be used to create standalone LLM applications that can be deployed anywhere Node.js is supported, or it can be used as part of a larger React application.

Features

AI.JSX comes with the following features out-of-the-box:

  • Componetized → LLM prompt engineering through modular, reusable components.
  • Model Support → Use OpenAI, Anthropic, Llama2, or BYOM. Seamlessly switch between model providers and LLM config (e.g. temperature).
  • Complete AI Toolbox → Built-in support for Tools, Document Question and Answering, and more.
  • Generative UI → Seamlessly interweave LLM calls with standard UI components. LLM can dynamically render UI from a set of components you provide.
  • Streaming → Built-in streaming support.
  • Modern Web Stack Support → First-class support for NextJS and Create React App. (more coming soon)
  • LangChain Integration → Full support for LangChainJS.

Learning AI.JSX

To get started with AI.JSX, follow these steps:

  1. Check out the Getting Started Guide.
  2. Run through the AI.JSX Tutorial.
  3. Say "Hello AI World" by cloning the ai-jsx-template.
  4. Discover many more use cases in the examples package.
  5. If you're new to AI, read the Guide for AI Newcomers.

Examples

Here is a simple example using AI.JSX to generate an AI response to a prompt:

import * as AI from 'ai-jsx';
import { ChatCompletion, UserMessage } from 'ai-jsx/core/completion';

const app = (
  <ChatCompletion>
    <UserMessage>Write a Shakespearean sonnet about AI models.</UserMessage>
  </ChatCompletion>
);
const renderContext = AI.createRenderContext();
const response = await renderContext.render(app);
console.log(response);

You can play with live demos on our live demo app or view the source code. For a full set of examples, see the examples package.

Check-out the 2 minute intro video.

Contributing

We welcome contributions! See the Contribution Guide for details on how to get started.

License

AI.JSX is open-source software and released under the MIT license.