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

# prompts

## GlobalPromptTemplates

### create

```python theme={null}
def create(self,
           name: str,
           template: Union[builtins.list[Message], str],
           project_id: Optional[str]=None,
           project_name: Optional[str]=None) -> PromptTemplate
```

Create a new global prompt template.

**Arguments**

* `name` (`str`): The name for the new template.
* `template` (`Union[list[Message], str]`): The template content. Can be either a list of Message objects or a JSON string.
* `project_id` (`Optional[str]`): The project ID to associate with this template. Defaults to None.
* `project_name` (`Optional[str]`): The project name to associate with this template. Defaults to None.
  Cannot be used together with project\_id.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.
* `ValueError`: If both project\_id and project\_name are provided, or if project\_name doesn't exist.

**Returns**

* `PromptTemplate`: The created prompt template.

### delete

```python theme={null}
def delete(self,
           *,
           template_id: Optional[str]=None,
           name: Optional[str]=None) -> None
```

Delete a global prompt template by ID or name.

**Arguments**

* `template_id` (`Optional[str]`): The unique identifier of the template to delete. Defaults to None.
* `name` (`Optional[str]`): The name of the template to delete. Defaults to None.

**Raises**

* `ValueError`: If neither or both template\_id and name are provided, or if the template is not found.

### list

```python theme={null}
def list(self,
         *,
         name_filter: Optional[str]=None,
         project_id: Optional[str]=None,
         project_name: Optional[str]=None,
         limit: Union[Unset, int]=100,
         starting_token: int=0) -> builtins.list[PromptTemplate]
```

List global prompt templates with optional filtering.

**Arguments**

* `name_filter` (`Optional[str]`): Filter templates by name containing this string. Defaults to None.
* `project_id` (`Optional[str]`): Filter templates by project ID. Returns templates used in the specified project. Defaults to None.
* `project_name` (`Optional[str]`): Filter templates by project name. Returns templates used in the specified project. Defaults to None.
  Cannot be used together with project\_id.
* `limit` (`Union[Unset, int]`): Maximum number of templates to return. Defaults to 100.
* `starting_token` (`int`): Starting token for pagination. Defaults to 0.

**Raises**

* `ValueError`: If both project\_id and project\_name are provided, or if project\_name doesn't exist.

**Returns**

* `list[PromptTemplate]`: List of prompt templates matching the criteria.

### render\_template

```python theme={null}
def render_template(self,
                    *,
                    template: str,
                    data: Union[DatasetData, StringData],
                    starting_token: Union[Unset, int]=0,
                    limit: Union[Unset, int]=100) -> RenderTemplateResponse
```

Render a template with provided data.

**Arguments**

* `template` (`str`): The template string to render.
* `data` (`Union[DatasetData, StringData]`): The data to use for rendering the template. Can be either dataset data or string data.
* `starting_token` (`Union[Unset, int]`): Starting token for pagination. Defaults to 0.
* `limit` (`Union[Unset, int]`): Maximum number of rendered templates to return. Defaults to 100.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.

**Returns**

* `Optional[RenderTemplateResponse]`: The rendered template response if successful, None otherwise.

### update

```python theme={null}
def update(self, *, template_id: str, name: str) -> PromptTemplate
```

Update a global prompt template.

**Arguments**

* `template_id` (`str`): The ID of the template to update.
* `name` (`str`): The new name for the template.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.

**Returns**

* `PromptTemplate`: The updated prompt template.

## PromptTemplates

Class for managing project-specific prompt templates.

<Danger>**Deprecated.** This class is deprecated as templates are now global. Use the module-level
functions `get_prompts`, `create_prompt`, etc. instead.
This class will be removed in a future version.</Danger>

### create

```python theme={null}
def create(self,
           name: str,
           template: Union[builtins.list[Message], str]) -> PromptTemplate
```

Create a template in this project.

**Arguments**

* `name` (`str`): The template name.
* `template` (`Union[list[Message], str]`): The template content.

**Returns**

* `PromptTemplate`: The created template.

### delete

```python theme={null}
def delete(self, *, name: str) -> None
```

Delete a template by name from this project.

**Arguments**

* `name` (`str`): The template name.

### get

```python theme={null}
def get(self, *, name: str) -> Optional[PromptTemplate]
```

Get a template by name from this project.

**Arguments**

* `name` (`str`): The template name.

**Returns**

* `Optional[PromptTemplate]`: The template if found, None otherwise.

### list

```python theme={null}
def list(self) -> builtins.list[PromptTemplate]
```

List templates for this project.

**Returns**

* `list[PromptTemplate]`: List of templates associated with the project.

## create\_prompt

```python theme={null}
def create_prompt(name: str,
                  template: Union[builtins.list[Message], str],
                  project_id: Optional[str]=None,
                  project_name: Optional[str]=None) -> PromptTemplate
```

Create a new global prompt template.

**Arguments**

* `name` (`str`): The name for the new template.
* `template` (`Union[list[Message], str]`): The template content. Can be either a list of Message objects or a JSON string
  representing the message structure.
* `project_id` (`Optional[str]`): The project ID to associate with this template. When provided, the template
  will be linked to the specified project. Defaults to None.
* `project_name` (`Optional[str]`): The project name to associate with this template. When provided, the template
  will be linked to the specified project. Defaults to None.
  Cannot be used together with project\_id.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.
* `ValueError`: If both project\_id and project\_name are provided, or if project\_name doesn't exist.

**Returns**

* `PromptTemplate`: The created prompt template.

## create\_prompt\_template

```python theme={null}
def create_prompt_template(name: str,
                           project: str,
                           messages: builtins.list[Message]) -> PromptTemplate
```

Create a new global prompt template.

<Danger>**Deprecated.** Use `create_prompt` instead.</Danger>

**Arguments**

* `name` (`str`): The name for the new template.
* `project` (`str`): The project name to associate with this template.
* `messages` (`list[Message]`): The template content as a list of Message objects.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.
* `ValueError`: If project doesn't exist.

**Returns**

* `PromptTemplate`: The created prompt template.

## delete\_prompt

```python theme={null}
def delete_prompt(*,
                  id: Optional[str]=None,
                  name: Optional[str]=None,
                  project_id: Optional[str]=None,
                  project_name: Optional[str]=None) -> None
```

Delete a global prompt template by ID or name.

You must provide either 'id' or 'name', but not both.

**Arguments**

* `id` (`str`): The unique identifier of the template to delete. Defaults to None.
* `name` (`str`): The name of the template to delete. Defaults to None.
* `project_id` (`str`): **Deprecated.** This parameter is ignored.
* `project_name` (`str`): **Deprecated.** This parameter is ignored.

**Raises**

* `ValueError`: If neither or both id and name are provided, or if the template is not found.

**Returns**

* `None`:

## get\_prompt

```python theme={null}
def get_prompt(*,
               id: Optional[str]=None,
               name: Optional[str]=None,
               project_id: Optional[str]=None,
               project_name: Optional[str]=None) -> Optional[PromptTemplate]
```

Retrieves a global prompt template.

You must provide either 'id' or 'name', but not both.

**Arguments**

* `id` (`str`): The unique identifier of the template to retrieve. Defaults to None.
* `name` (`str`): The name of the template to retrieve. Defaults to None.
* `project_id` (`str`): **Deprecated.** This parameter is ignored. Use get\_prompts(project\_id=...) to filter templates by project.
* `project_name` (`str`): **Deprecated.** This parameter is ignored. Use get\_prompts(project\_name=...) to filter templates by project.

**Raises**

* `ValueError`: If neither or both 'id' and 'name' are provided.

**Returns**

* `Optional[PromptTemplate]`: The template if found, None otherwise.

## get\_prompt\_template

```python theme={null}
def get_prompt_template(name: str, project: str) -> Optional[PromptTemplate]
```

Get a prompt template by name from a specific project.

<Danger>**Deprecated.** Use `get_prompt` with `name` parameter or `get_prompts` with
`project_name` parameter instead. This function is deprecated and will be
removed in a future version.</Danger>

**Arguments**

* `name` (`str`): The name of the template.
* `project` (`str`): The project name (ignored - templates are now global).

**Returns**

* `Optional[PromptTemplate]`: The template if found, None otherwise.

## get\_prompts

```python theme={null}
def get_prompts(name_filter: Optional[str]=None,
                project_id: Optional[str]=None,
                project_name: Optional[str]=None,
                limit: Union[Unset, int]=100) -> builtins.list[PromptTemplate]
```

List global prompt templates with optional filtering.

**Arguments**

* `name_filter` (`Optional[str]`): Filter templates by name containing this string. Defaults to None (no filtering).
* `project_id` (`Optional[str]`): Filter templates by project ID. Returns templates used in the specified project. Defaults to None.
* `project_name` (`Optional[str]`): Filter templates by project name. Returns templates used in the specified project. Defaults to None.
  Cannot be used together with project\_id.
* `limit` (`Union[Unset, int]`): Maximum number of templates to return. Defaults to 100.

**Raises**

* `ValueError`: If both project\_id and project\_name are provided, or if project\_name doesn't exist.

**Returns**

* `list[PromptTemplate]`: List of prompt templates matching the criteria.

## list\_prompt\_templates

```python theme={null}
def list_prompt_templates(project: str) -> builtins.list[PromptTemplate]
```

List prompt templates for a project.

<Danger>**Deprecated.** Use `get_prompts` with `project_name` parameter instead.
This function is deprecated and will be removed in a future version.</Danger>

**Arguments**

* `project` (`str`): The project name to filter templates by.

**Returns**

* `list[PromptTemplate]`: List of prompt templates associated with the project.

## render\_template

```python theme={null}
def render_template(*,
                    template: str,
                    data: Union[DatasetData, StringData, list[str], str],
                    starting_token: Union[Unset, int]=0,
                    limit: Union[Unset, int]=100) -> RenderTemplateResponse
```

Render a template with provided data.

**Arguments**

* `template` (`str`): The template string to render.
* `data` (`Union[DatasetData, StringData, list[str], str]`): The data to use for rendering the template. Can be:
  * DatasetData: Reference to a dataset
  * StringData: List of input strings
  * list\[str]: List of input strings (will be converted to StringData)
  * str: Dataset ID (will be converted to DatasetData)
* `starting_token` (`Union[Unset, int]`): Starting token for pagination. Defaults to 0.
* `limit` (`Union[Unset, int]`): Maximum number of rendered templates to return. Defaults to 100.

**Raises**

* `PromptTemplateAPIException`: If the API request fails or returns an error.

**Returns**

* `Optional[RenderTemplateResponse]`: The rendered template response if successful, None otherwise.

## update\_prompt

```python theme={null}
def update_prompt(*,
                  id: Optional[str]=None,
                  name: Optional[str]=None,
                  new_name: str) -> PromptTemplate
```

Update a global prompt template by ID or name.

**Arguments**

* `id` (`str`): The unique identifier of the template to update. Defaults to None.
* `name` (`str`): The name of the template to update. Defaults to None.
* `new_name` (`str`): The new name for the template.

**Raises**

* `ValueError`: If neither or both id and name are provided, or if the template is not found.
* `PromptTemplateAPIException`: If the API request fails or returns an error.

**Returns**

* `PromptTemplate`: The updated prompt template.
