# `GenAI.ThreadProtocol`

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `append_directive`

# `effective_messages`

# `effective_model`

# `effective_model_settings`

# `effective_provider_settings`

# `effective_safety_settings`

# `effective_settings`

# `effective_tools`

# `execute`

# `get_artifact`

# `set_artifact`

# `with_api_key`

Specify an API key for a provider.

# `with_api_org`

Specify an API org for a provider.

# `with_message`

Add a message to the conversation.

# `with_messages`

Add a list of messages to the conversation.

# `with_model`

Specify a specific model or model picker.

This function allows you to define the model to be used for inference. You can either provide a specific model, like `Model.smartest()`, or a model picker function that dynamically selects the best model based on the context and available providers.

Examples:
* `Model.smartest()` - This will select the "smartest" available model at inference time, based on factors like performance and capabilities.
* `Model.cheapest(params: :best_effort)` - This will select the cheapest available model that can handle the given parameters and context size.
* `CustomProvider.custom_model` - This allows you to use a custom model from a user-defined provider.

# `with_model_setting`

# `with_model_setting`

# `with_model_settings`

# `with_model_settings`

# `with_provider_setting`

# `with_provider_setting`

# `with_provider_settings`

# `with_provider_settings`

# `with_safety_setting`

# `with_safety_setting`

# `with_safety_settings`

# `with_setting`

# `with_setting`

Set a hyperparameter option.

Some options are model-specific. The value can be a literal or a picker function that dynamically determines the best value based on the context and model.

Examples:
* `Parameter.required(name, value)` - This sets a required parameter with the specified name and value.
* `Gemini.best_temperature_for(:chain_of_thought)` - This uses a picker function to determine the best temperature for the Gemini provider when using the "chain of thought" prompting technique.

# `with_settings`

# `with_stream_handler`

# `with_tool`

# `with_tools`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
