Title: PromptBuilder::usingModelConfig
Published: May 20, 2026

---

# PromptBuilder::usingModelConfig( WordPressAiClientProvidersModelsDTOModelConfig $config ): self

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#wp--skip-link--target)

Sets the model configuration.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#description)󠁿

Merges the provided configuration with the builder’s configuration, with builder
configuration taking precedence.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#parameters)󠁿

 `$config`WordPressAiClientProvidersModelsDTOModelConfigrequired

The model configuration to merge.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#return)󠁿

 self

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#source)󠁿

    ```php
    public function usingModelConfig(ModelConfig $config): self
    {
        // Convert both configs to arrays
        $builderConfigArray = $this->modelConfig->toArray();
        $providedConfigArray = $config->toArray();
        // Merge arrays with builder config taking precedence
        $mergedArray = array_merge($providedConfigArray, $builderConfigArray);
        // Create new config from merged array
        $this->modelConfig = ModelConfig::fromArray($mergedArray);
        return $this;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/src/builders/promptbuilder.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/php-ai-client/src/Builders/PromptBuilder.php#L301)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/php-ai-client/src/Builders/PromptBuilder.php#L301-L311)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#related)󠁿

| Uses | Description | 
| [ModelConfig::fromArray()](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelconfig/fromarray/)`wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php` |

{@inheritDoc}

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-builders-promptbuilder/usingmodelconfig/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.1.0](https://developer.wordpress.org/reference/since/0.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwordpress-aiclient-builders-promptbuilder%2Fusingmodelconfig%2F)
before being able to contribute a note or feedback.