fixie-ai / ai-jsx

The AI Application Framework for Javascript
https://docs.ai-jsx.com
MIT License
1.03k stars 76 forks source link
ai jsx nextjs react typescript

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:

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.