> ## 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

export const GCell = ({children, className}) => <div className={`grid-table-cell ${className || ""}`} role="cell">
    {children}
  </div>;

export const GTH = ({children, className}) => <div className={`grid-table-th ${className || ""}`} role="columnheader">
    {children}
  </div>;

export const GRow = ({children}) => <div className="grid-table-row" role="row">{children}</div>;

export const GBody = ({children}) => <div className="grid-table-body" role="rowgroup">{children}</div>;

export const GHead = ({children}) => <div className="grid-table-head" role="rowgroup">{children}</div>;

export const GTable = ({children, className, cols}) => <div className={`grid-table not-prose overflow-hidden rounded-2xl ${className || ""}`} style={{
  "--grid-table-cols": cols
}} role="table">
    {children}
  </div>;

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](/docs/getting-started/working-with-conda/packages/pip-install#using-pip-install-in-a-conda-environment).
</Warning>

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:

<GTable cols="20% 15% 40% 25%">
  <GHead>
    <GRow>
      <GTH>Parameter</GTH>
      <GTH>Type</GTH>
      <GTH>Description</GTH>
      <GTH>Default</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`model`</GCell>
      <GCell>`str`</GCell>
      <GCell>Model name</GCell>
      <GCell>Required</GCell>
    </GRow>

    <GRow>
      <GCell>`system_prompt`</GCell>
      <GCell>`str`</GCell>
      <GCell>System prompt</GCell>
      <GCell>`None`</GCell>
    </GRow>

    <GRow>
      <GCell>`temperature`</GCell>
      <GCell>`float`</GCell>
      <GCell>Sampling temperature</GCell>
      <GCell>`0.1`</GCell>
    </GRow>

    <GRow>
      <GCell>`max_tokens`</GCell>
      <GCell>`int`</GCell>
      <GCell>Max tokens to predict</GCell>
      <GCell>Model default</GCell>
    </GRow>

    <GRow>
      <GCell>`extra_options`</GCell>
      <GCell>`dict`</GCell>
      <GCell>Server configuration options</GCell>
      <GCell>`None`</GCell>
    </GRow>
  </GBody>
</GTable>

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