> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex

Install the `llama-index-llms-openai` package:

```sh theme={null}
pip install llama-index-llms-openai
```

> [!WARNING]
>
> Only `pip install` packages in your conda environment once all other packages and their dependencies have been installed. For more information on installing pip packages in your conda environment, see [Installing pip packages](https://anaconda.com/docs/getting-started/working-with-conda/packages/pip-install.md#using-pip-install-in-a-conda-environment).

Here is a minimal setup example for using LlamaIndex with Anaconda AI:

```py theme={null}
from anaconda_ai.integrations.llama_index import AnacondaModel

llm = AnacondaModel(
    model='OpenHermes-2.5-Mistral-7B_q4_k_m'
)

# Or with custom server configuration:
llm = AnacondaModel(
    model='OpenHermes-2.5-Mistral-7B_q4_k_m',
    temperature=0.7,
    extra_options={
        'ctx_size': 4096,
        'n_gpu_layers': 20,
        'port': 8080
    }
)
```

To use an already running server, pass `server/<server-name>` as the model:

```python theme={null}
llm = AnacondaModel('server/my-server')
```

The `AnacondaModel` class supports the following arguments:

Parameter

Type

Description

Default

`model`

`str`

Model name

Required

`system_prompt`

`str`

System prompt

`None`

`temperature`

`float`

Sampling temperature

`0.1`

`max_tokens`

`int`

Max tokens to predict

Model default

`extra_options`

`dict`

Server configuration options

`None`

For more information on using the `llama-index-llms-openai` package, see the [official documentation](https://pypi.org/project/llama-index-llms-openai/).
