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

# Models

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

The `.models` accessor provides methods for listing and downloading models.

<GTable cols="30% 30% 40%">
  <GHead>
    <GRow>
      <GTH>Method</GTH>
      <GTH>Return type</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`.list()`</GCell>
      <GCell>`List[Model]`</GCell>
      <GCell>List all available models</GCell>
    </GRow>

    <GRow>
      <GCell>`.get('<MODEL>')`</GCell>
      <GCell>`Model`</GCell>
      <GCell>Fetch model metadata and quantizations</GCell>
    </GRow>

    <GRow>
      <GCell>`.download('<MODEL>/<QUANT>')`</GCell>
      <GCell>`None`</GCell>
      <GCell>Download a quantized model file</GCell>
    </GRow>

    <GRow>
      <GCell>`.delete('<MODEL>/<QUANT>')`</GCell>
      <GCell>`None`</GCell>
      <GCell>Delete a downloaded model file</GCell>
    </GRow>
  </GBody>
</GTable>

## Model class

<GTable cols="30% 30% 40%">
  <GHead>
    <GRow>
      <GTH>Attribute/Method</GTH>
      <GTH>Type</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`.name`</GCell>
      <GCell>`str`</GCell>
      <GCell>Model name</GCell>
    </GRow>

    <GRow>
      <GCell>`.description`</GCell>
      <GCell>`str`</GCell>
      <GCell>Model description</GCell>
    </GRow>

    <GRow>
      <GCell>`.num_parameters`</GCell>
      <GCell>`int`</GCell>
      <GCell>Number of model parameters</GCell>
    </GRow>

    <GRow>
      <GCell>`.trained_for`</GCell>
      <GCell>`str`</GCell>
      <GCell>Training purpose (for example, 'text-generation', 'feature-extraction')</GCell>
    </GRow>

    <GRow>
      <GCell>`.context_window_size`</GCell>
      <GCell>`int`</GCell>
      <GCell>Context window length</GCell>
    </GRow>

    <GRow>
      <GCell>`.quantized_files`</GCell>
      <GCell>`List[QuantizedFile]`</GCell>
      <GCell>Available quantization files</GCell>
    </GRow>

    <GRow>
      <GCell>`.get_quantization('<QUANT>')`</GCell>
      <GCell>`QuantizedFile`</GCell>
      <GCell>Get a specific quantization by method</GCell>
    </GRow>

    <GRow>
      <GCell>`.download('<QUANT>')`</GCell>
      <GCell>`None`</GCell>
      <GCell>Download a specific quantization</GCell>
    </GRow>

    <GRow>
      <GCell>`.delete('<QUANT>')`</GCell>
      <GCell>`None`</GCell>
      <GCell>Delete a specific quantization</GCell>
    </GRow>
  </GBody>
</GTable>

## QuantizedFile class

<GTable cols="30% 30% 40%">
  <GHead>
    <GRow>
      <GTH>Attribute/Method</GTH>
      <GTH>Type</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`.sha256`</GCell>
      <GCell>`str`</GCell>
      <GCell>SHA256 checksum of the model file</GCell>
    </GRow>

    <GRow>
      <GCell>`.size_bytes`</GCell>
      <GCell>`int`</GCell>
      <GCell>File size in bytes</GCell>
    </GRow>

    <GRow>
      <GCell>`.quant_method`</GCell>
      <GCell>`str`</GCell>
      <GCell>Quantization method (for example, 'Q4\_K\_M', 'Q8\_0')</GCell>
    </GRow>

    <GRow>
      <GCell>`.max_ram_usage`</GCell>
      <GCell>`int`</GCell>
      <GCell>Required RAM in bytes</GCell>
    </GRow>

    <GRow>
      <GCell>`.format`</GCell>
      <GCell>`str`</GCell>
      <GCell>File format (typically 'gguf')</GCell>
    </GRow>

    <GRow>
      <GCell>`.identifier`</GCell>
      <GCell>`str`</GCell>
      <GCell>Full filename (for example, 'model\_name\_q4\_k\_m.gguf')</GCell>
    </GRow>

    <GRow>
      <GCell>`.is_downloaded`</GCell>
      <GCell>`bool`</GCell>
      <GCell>Whether the file is downloaded</GCell>
    </GRow>

    <GRow>
      <GCell>`.is_allowed`</GCell>
      <GCell>`bool`</GCell>
      <GCell>Whether the file is available on this system</GCell>
    </GRow>

    <GRow>
      <GCell>`.local_path`</GCell>
      <GCell>`Optional[Path]`</GCell>
      <GCell>Local file path (if downloaded)</GCell>
    </GRow>

    <GRow>
      <GCell>`.download()`</GCell>
      <GCell>`None`</GCell>
      <GCell>Download this quantization file</GCell>
    </GRow>

    <GRow>
      <GCell>`.delete()`</GCell>
      <GCell>`None`</GCell>
      <GCell>Delete this quantization file</GCell>
    </GRow>
  </GBody>
</GTable>

## Downloading models

Download a quantized model file using one of the following approaches:

<Tabs>
  <Tab title="Using client.models.download()">
    ```py theme={null}
    client.models.download('OpenHermes-2.5-Mistral-7B/Q4_K_M')
    ```

    <Note>
      `client.models.download()` accepts either a string reference (`'model/quantization'`) or a `QuantizedFile` object.

      ***

      If the model has already been downloaded, the function exits immediately. Otherwise, a progress bar displays.
    </Note>
  </Tab>

  <Tab title="Using Model.download()">
    ```py theme={null}
    model = client.models.get('OpenHermes-2.5-Mistral-7B')
    model.download('Q4_K_M')
    ```
  </Tab>

  <Tab title="Using QuantizedFile.download()">
    ```py theme={null}
    model = client.models.get('OpenHermes-2.5-Mistral-7B')
    quantization = model.get_quantization('Q4_K_M')
    quantization.download()
    ```
  </Tab>
</Tabs>

## Example usage

```py theme={null}
from anaconda_ai import AnacondaAIClient

client = AnacondaAIClient()

# List all models
models = client.models.list()
for model in models:
    print(f"{model.name}: {model.num_parameters / 1e9:.1f}B parameters")

# Get specific model details
model = client.models.get('OpenHermes-2.5-Mistral-7B')
print(f"Description: {model.description}")
print(f"Trained for: {model.trained_for}")

# Check available quantizations
for quant in model.quantized_files:
    status = "downloaded" if quant.is_downloaded else "available"
    print(f"  {quant.quant_method}: {status} ({quant.size_bytes / 1e9:.1f}GB)")

# Download and use a quantization
if not model.get_quantization('Q4_K_M').is_downloaded:
    model.download('Q4_K_M')

quantization = model.get_quantization('Q4_K_M') 
print(f"Local path: {quantization.local_path}")
```
