## How generative AI works

Generative AI operates through a multi-step process that transforms your input into meaningful output:

### Core components

**Prompts** are the instructions you give to the AI model. They can be short questions, detailed instructions, or examples of the desired output format. Learn effective [prompting techniques](https://dev.writer.com/home/prompting) to get the results you want.

**Foundation models** are large neural networks trained on vast amounts of text data. Writer offers [multiple Palmyra models](https://dev.writer.com/home/models) with different capabilities, from fast text generation to advanced reasoning and tool calling.

**Tokenization** breaks down your input into smaller units (tokens) that the model can process. Understanding [tokens and pricing](https://dev.writer.com/home/tokens) helps you improve costs and performance.

**Neural network processing** is where the model analyzes patterns, context, and relationships to determine the most appropriate response based on its training.

**Safety filtering** checks generated content for harmful, biased, or inappropriate material. Writer includes [built-in safety features](https://dev.writer.com/home/toxic-check) to ensure responsible AI usage.

## Writer’s model capabilities

### Palmyra models

Writer’s [Palmyra models](https://dev.writer.com/home/models) provide different capabilities optimized for various use cases. [Palmyra X5](https://dev.writer.com/home/models#palmyra-x5) has a 1M token context window, adaptive reasoning, and speed and cost efficiency. It covers general-purpose, financial, medical, and creative use cases. [Palmyra X4](https://dev.writer.com/home/models#palmyra-x4) is also available for complex tasks that require extended context.

### Specialized features

- **Tool calling**: Enable models to use [external tools and APIs](https://dev.writer.com/agent-builder/tool-calling-intro) for enhanced functionality
- **Vision capabilities**: Process and analyze images alongside text using [chat with images](https://dev.writer.com/home/chat-with-images)
- **Knowledge Graph integration**: Connect to your data sources for accurate, contextual responses using [Knowledge Graph](https://dev.writer.com/home/knowledge-graph-concepts)
- **Streaming**: Get responses in real-time for better user experience with [streaming](https://dev.writer.com/home/streaming)

## Best practices

### Prompt engineering

- **Be specific**: Provide clear, detailed instructions for what you want
- **Use examples**: Show the model the format or style you’re looking for
- **Provide context**: Give relevant background information
- **Iterate and refine**: Test different approaches to improve results
- **Learn more**: Explore [prompting techniques](https://dev.writer.com/home/prompting) for advanced strategies

### Safety and reliability

- **Review outputs**: Always check generated content before using it
- **Set boundaries**: Define what the AI should and shouldn’t do
- **Monitor performance**: Track quality and adjust as needed
- **Handle errors gracefully**: Plan for cases where the AI doesn’t perform as expected

### Performance optimization

- **Choose appropriate models**: Select the right [Palmyra model](https://dev.writer.com/home/models) for your use case
- **Optimize prompts**: Use clear, concise language and follow [common prompting strategies](https://dev.writer.com/home/prompting)
- **Manage context length**: Stay within [token limits](https://dev.writer.com/home/tokens) for best performance
- **Use streaming**: Enable [streaming responses](https://dev.writer.com/home/streaming) for real-time delivery
- **Fine-tune parameters**: Adjust [model parameters](https://dev.writer.com/home/model-parameters) for optimal results

## Getting started with Writer

To begin using Writer’s generative AI in your applications:

1. **Choose a model** from [Writer’s available models](https://dev.writer.com/home/models) that fits your needs
2. **Design effective prompts** using [prompting techniques](https://dev.writer.com/home/prompting)
3. **Test and iterate** to improve performance
4. **Implement safety measures** using Writer’s [built-in safety features](https://dev.writer.com/home/toxic-check)
5. **Monitor and optimize** for ongoing success

## Next steps

- Start with the [API quickstart](https://dev.writer.com/home/quickstart) to get up and running
- Explore [Writer’s models](https://dev.writer.com/home/models) to find the right fit for your use case
- Learn [prompting techniques](https://dev.writer.com/home/prompting) for better results
- Understand [model parameters](https://dev.writer.com/home/model-parameters) for fine-tuning
- See how to [integrate with your applications](https://dev.writer.com/home/integrations-overview)
- Build [no-code agents](https://dev.writer.com/home/applications) for rapid prototyping
- Connect your data with [Knowledge Graph](https://dev.writer.com/home/knowledge-graph-concepts) for accurate responses.
