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

# Init Experiment

### Initialize an Experiment

#### Haiqu.init(experiment\_ctx, experiment\_description='', log\_source\_code=False)

Set the current experiment (create or use existing own or shared experiment).

If an experiment with this name doesn't exist yet, it will be created with the given description.

Most objects (e.g. circuits) and actions (e.g. running a job) must be associated with an experiment. The default
experiment will be used if one is not set explicitly.

* **Parameters:**
  * **experiment\_ctx** (*str*) -- The experiment name or ID of the shared experiment.
  * **experiment\_description** (*str*) -- An optional text description of the experiment. Only used when creating the experiment.
  * **log\_source\_code** (*bool*) -- If True, the source code of the running script or notebook is read and sent to the
    Haiqu cloud as an experiment metric (`source_code`). Defaults to False. Enable this only if you are
    comfortable uploading your source to the server. When stored, the source code is available on the
    Dashboard so it can be accessed and shared among other users. Its visibility follows the experiment's:
    anyone who can see the experiment can see the stored source code, with no additional option to toggle.
    Every version is preserved, giving you and your collaborators the full history of the experiment's
    source code.
* **Returns:**
  Status message, URL to view the experiment on the dashboard.
* **Return type:**
  str

#### Examples

```python theme={null}
>>> haiqu.init("Example Experiment", "The experiment to use for all examples.")
'Set current experiment to: Example Experiment. View on Dashboard: https://dashboard.haiqu.ai/experiments/...'
```

Shared experiment can be set by its ID:

```python theme={null}
>>> haiqu.init("exp-12345678-1234-5678-1234-567812345678")
```

Opt in to uploading the running script/notebook source code to the Haiqu cloud:

```python theme={null}
>>> haiqu.init("Example Experiment", log_source_code=True)
```

### Update the current experiment metadata

#### Haiqu.update\_experiment(name=None, description=None)

Update the current experiment metadata.
Set the current experiment if wasn't set.

* **Parameters:**
  * **name** (*str* *|* *None*) -- Updated experiment name. Defaults to the current name.
  * **description** (*str* *|* *None*) -- Updated experiment description. Defaults to the current description.
* **Returns:**
  Status message.
* **Return type:**
  str
