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

# Ml Repos

> SDK methods to create, update, list, and manage ML repositories for tracking experiments and models.

## Methods

<Accordion title="create_or_update">
  Creates or updates an MLRepo entity based on the provided manifest.

  #### Parameters

  <ParamField body="manifest" type="MlRepoManifest" required>
    [🔗 MlRepoManifest](/docs/truefoundry_sdk/types#mlrepomanifest)

    MLRepo manifest
  </ParamField>

  <ParamField body="dry_run" type="typing.Optional[bool]">
    Validate the manifest and collaborators without persisting changes or updating artifact location in the database
  </ParamField>

  #### Returns

  <ResponseField name="GetMlRepoResponse" type="GetMlRepoResponse">
    [🔗 GetMlRepoResponse](/docs/truefoundry_sdk/types#getmlreporesponse)

    Returns the created or updated MLRepo entity based on the provided manifest.
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.ml_repos.create_or_update(
      manifest={"key": "value"},
      dry_run=False,
  )
  ```
</Accordion>

<Accordion title="get">
  Get an ML Repo by its ID.

  #### Parameters

  <ParamField body="id" type="str" required />

  #### Returns

  <ResponseField name="GetMlRepoResponse" type="GetMlRepoResponse">
    [🔗 GetMlRepoResponse](/docs/truefoundry_sdk/types#getmlreporesponse)

    The ML Repo data
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.ml_repos.get(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="delete">
  Delete an ML Repo by its ID.

  #### Parameters

  <ParamField body="id" type="str" required />

  #### Returns

  <ResponseField name="EmptyResponse" type="EmptyResponse">
    [🔗 EmptyResponse](/docs/truefoundry_sdk/types#emptyresponse)

    Empty response indicating successful deletion
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.ml_repos.delete(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="list">
  List ML Repos with optional filtering by name.

  #### Parameters

  <ParamField body="name" type="typing.Optional[str]">
    Name of the ML Repo to filter by
  </ParamField>

  <ParamField body="limit" type="typing.Optional[int]">
    Maximum number of ML Repos to return
  </ParamField>

  <ParamField body="offset" type="typing.Optional[int]">
    Number of ML Repos to skip for pagination
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[MlRepo, ListMlReposResponse]" type="SyncPager[MlRepo, ListMlReposResponse]">
    [🔗 ListMlReposResponse](/docs/truefoundry_sdk/types#listmlreposresponse)

    List of ML Repos matching the query with pagination information
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.ml_repos.list(
      name="value",
      limit=10,
      offset=10,
  )

  # Iterate through results
  for item in response:
      print(item.name)

  # Or paginate page by page
  for page in response.iter_pages():
      for item in page:
          print(item.name)
  ```
</Accordion>
