# FAQ

## Installation & Setup

### What are the minimum requirements?

Liz requires Node.js 18+ and either SQLite or PostgreSQL for the database. For development, SQLite is recommended as it requires no additional setup. For production, PostgreSQL is recommended for better scalability.

### Why am I getting environment variable errors?

Make sure you've copied .env.example to .env and filled in all required variables:

* DATABASE\_URL for your database connection
* OPENAI\_API\_KEY for OpenAI API access
* OPENROUTER\_API\_KEY for OpenRouter API access
* APP\_URL for OpenRouter callbacks

### How do I switch from SQLite to PostgreSQL?

Update your DATABASE\_URL in .env and modify prisma/schema.prisma:

```prisma
// prisma/schema.prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}
```

Then run prisma migrate to update your database:

```bash
npm run prisma:migrate
```

## LLM Integration

### Can I use different LLM providers?

Yes, Liz supports both OpenAI and OpenRouter APIs. OpenRouter gives you access to models from Anthropic, Google, and others. You can specify the model when calling LLMUtils methods:

```typescript
// OpenAI GPT-4
await llmUtils.getTextFromLLM(prompt, "openai/gpt-4");

// Anthropic Claude
await llmUtils.getTextFromLLM(prompt, "anthropic/claude-3-sonnet");

// Google PaLM
await llmUtils.getTextFromLLM(prompt, "google/palm-2");
```

### How do I handle rate limits?

Implement exponential backoff and retry logic in your routes:

```typescript
async function withRetry(fn, maxRetries = 3) {
	let retries = 0;
	while (retries < maxRetries) {
		try {
			return await fn();
		} catch (error) {
			if (!error.message.includes("rate limit")) throw error;
			retries++;
			await new Promise((r) => setTimeout(r, Math.pow(2, retries) * 1000));
		}
	}
	throw new Error("Max retries exceeded");
}
```

## Performance

### How can I optimize memory usage?

Several strategies can help manage memory usage:

* Limit the number of memories loaded per request
* Implement memory pruning for old conversations
* Use database indexing effectively
* Consider memory summarization for long conversations

### How do I handle high traffic?

For high-traffic applications:

* Use PostgreSQL instead of SQLite
* Implement request queuing
* Cache common responses
* Use load balancing with multiple instances

## Twitter Integration

### Why is my Twitter bot not working?

Common Twitter integration issues:

* Incorrect credentials in environment variables
* Missing 2FA secret for accounts with 2FA enabled
* Rate limiting from too frequent posting
* Network issues preventing login

Use dryRun mode to test your bot without posting:

```bash
TWITTER_DRY_RUN=true
```

## Contributing

### How can I contribute to Liz?

We welcome contributions! Here's how to get started:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

Please follow our coding standards and include clear commit messages.

[← Back to Docs Home](/readme.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akrasia.ai/documentation/faq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
