# Overview

> **Note:** This page is a beginner-friendly introduction to high-level artificial intelligence (AI) concepts. To dive right into implementing the Go AI SDK, feel free to skip ahead to the [Generating Text guide](https://goaisdk.com/docs/ai-sdk-core/generating-text.md) or learn about our [supported models and providers](https://goaisdk.com/docs/foundations/providers-and-models.md).

The Go AI SDK standardizes integrating artificial intelligence (AI) models across [supported providers](https://goaisdk.com/docs/foundations/providers-and-models.md). This enables developers to focus on building great AI applications in Go, not waste time on technical details.

For example, here's how you can generate text with various models using the Go AI SDK:

```go
package main

import (
    "context"
    "fmt"
    "log"
    "os"

    "github.com/digitallysavvy/go-ai/pkg/ai"
    "github.com/digitallysavvy/go-ai/pkg/provider"
    "github.com/digitallysavvy/go-ai/pkg/providers/openai"
    "github.com/digitallysavvy/go-ai/pkg/providers/anthropic"
    "github.com/digitallysavvy/go-ai/pkg/providers/google"
)

func main() {
    ctx := context.Background()

    // OpenAI
    openaiProvider := openai.New(openai.Config{APIKey: os.Getenv("OPENAI_API_KEY")})
    gpt4, _ := openaiProvider.LanguageModel("gpt-4")

    // Anthropic
    anthropicProvider := anthropic.New(anthropic.Config{APIKey: os.Getenv("ANTHROPIC_API_KEY")})
    claude, _ := anthropicProvider.LanguageModel("claude-3-5-sonnet-20241022")

    // Google
    googleProvider := google.New(google.Config{APIKey: os.Getenv("GOOGLE_GENERATIVE_AI_API_KEY")})
    gemini, _ := googleProvider.LanguageModel("gemini-1.5-flash")

    // Same API for all providers
    for _, model := range []provider.LanguageModel{gpt4, claude, gemini} {
        result, err := ai.GenerateText(ctx, ai.GenerateTextOptions{
            Model:  model,
            Prompt: "What is love?",
        })
        if err != nil {
            log.Fatal(err)
        }

        fmt.Println(result.Text)
    }
}
```

To effectively leverage the Go AI SDK, it helps to familiarize yourself with the following concepts:

## Generative Artificial Intelligence

**Generative artificial intelligence** refers to models that predict and generate various types of outputs (such as text, images, or audio) based on what's statistically likely, pulling from patterns they've learned from their training data. For example:

- Given a photo, a generative model can generate a caption.
- Given an audio file, a generative model can generate a transcription.
- Given a text description, a generative model can generate an image.

## Large Language Models

A **large language model (LLM)** is a subset of generative models focused primarily on **text**. An LLM takes a sequence of words as input and aims to predict the most likely sequence to follow. It assigns probabilities to potential next sequences and then selects one. The model continues to generate sequences until it meets a specified stopping criterion.

LLMs learn by training on massive collections of written text, which means they will be better suited to some use cases than others. For example, a model trained on GitHub data would understand the probabilities of sequences in source code particularly well.

However, it's crucial to understand LLMs' limitations. When asked about less known or absent information, like the birthday of a personal relative, LLMs might "hallucinate" or make up information. It's essential to consider how well-represented the information you need is in the model.

## Embedding Models

An **embedding model** is used to convert complex data (like words or images) into a dense vector (a list of numbers) representation, known as an embedding. Unlike generative models, embedding models do not generate new text or data. Instead, they provide representations of semantic and syntactic relationships between entities that can be used as input for other models or other natural language processing tasks.

## Reranking Models

A **reranking model** is used to reorder a list of documents based on their relevance to a query. Unlike embedding models that generate vector representations, reranking models directly score document-query pairs for relevance. This is particularly useful for search and retrieval-augmented generation (RAG) applications where you need to rank multiple candidates by their relevance to a specific query.

## Go-Specific Advantages

The Go AI SDK brings the power of AI to Go developers with several advantages:

- **Idiomatic Go**: Uses Go conventions like `context.Context`, channels, and error returns
- **Type Safety**: Strong typing with Go's type system
- **Performance**: Compiled language performance for production workloads
- **Concurrency**: Built-in support for concurrent operations with goroutines
- **Easy Deployment**: Single binary deployment without runtime dependencies
- **Standard Library**: Integrates seamlessly with Go's standard library

---

In the next section, you will learn about the difference between model providers and models, and which ones are available in the Go AI SDK.

## See Also

- [Providers and Models](https://goaisdk.com/docs/foundations/providers-and-models.md)
- [Prompts](https://goaisdk.com/docs/foundations/prompts.md)
- [Tools](https://goaisdk.com/docs/foundations/tools.md)
- [Streaming](https://goaisdk.com/docs/foundations/streaming.md)
