# @target(...)

`prism.decorators.target(`*`*, type: prism.target.PrismTarget, loc: Union[str, pathlib.Path]`*`)`

* **Parameters**
  * `*`: indicates that the `target` decorator only accepts keyword arguments.
  * `type`: a valid Prism target. This controls the output type, e.g., a `.txt` file, a `.csv`, a `.json`, etc. Prism targets are classes that inherit the `prism.target.PrismTarget` class and implement the `save` method. See here.
  * `loc`: a string or path-like object that controls where the output saved.

**Example:**

{% tabs %}
{% tab title="Class-based tasks" %}

```python
import prism.task
import prism.target
import prism.decorators

class ExampleTask(prism.task.PrismTask):
    
    @prism.decorators.target(
        type=prism.target.Txt, 
        loc="/Users/hello_world.txt",
        **kwargs
    )
    def run(self, tasks, hooks):
        test_str = "Hello, world!"
        return test_str
```

{% endtab %}

{% tab title="Function-based tasks" %}

```python
from prism.decorators import task, target
import prism.target

@task(
    targets=[
        target(type=prism.target.Txt, loc="/Users/hello_world.txt")
    ]
)
def example_function(tasks, hooks):
    test_str = "Hello, world!"
    return test_str
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.runprism.com/v0.2.7/api-reference/target-....md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
