@agent-labs/ag-ui-server
Version:
AG-UI Node.js server with OpenAI integration
91 lines (65 loc) • 1.51 kB
Markdown
with OpenAI integration for AG-UI applications.
- 🚀 TypeScript + ESM support
- 🔌 OpenAI integration
- ⚡️ Express server
- 📦 Easy to use API
- 🔒 Environment-based configuration
```bash
npm install ag-ui-server
pnpm add ag-ui-server
yarn add ag-ui-server
```
```typescript
import { OpenAIAgent, createServer } from 'ag-ui-server';
// Create an OpenAI agent
const agent = new OpenAIAgent({
openaiApiKey: process.env.OPENAI_API_KEY,
model: 'gpt-3.5-turbo',
});
// Create and start the server
const app = createServer(agent);
app.listen(3000, () => {
console.log('Server running on port 3000');
});
```
```typescript
import { OpenAIAgent } from 'ag-ui-server';
const agent = new OpenAIAgent({
openaiApiKey: string,
model?: string,
temperature?: number,
maxTokens?: number,
});
```
```typescript
import { createServer } from 'ag-ui-server';
const app = createServer(agent);
```
Environment variables:
- `OPENAI_API_KEY`: Your OpenAI API key (required)
- `OPENAI_MODEL`: Model to use (default: 'gpt-3.5-turbo')
- `OPENAI_TEMPERATURE`: Temperature for generation (default: 0.7)
- `OPENAI_MAX_TOKENS`: Max tokens per response (default: 1000)
## Development
```bash
# Install dependencies
pnpm install
# Start development server
pnpm run dev
# Build
pnpm run build
# Start production server
pnpm start
```
## License
MIT
A Node.js server