---
title: "prepareCustomLanguageModel(for:configuration:completion:)"
framework: speech
role: symbol
role_heading: Type Method
path: "speech/sfspeechlanguagemodel/preparecustomlanguagemodel(for:configuration:completion:)"
---

# prepareCustomLanguageModel(for:configuration:completion:)

Creates a language model from custom training data.

## Declaration

```swift
class func prepareCustomLanguageModel(for asset: URL, configuration: SFSpeechLanguageModel.Configuration, completion: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
class func prepareCustomLanguageModel(for asset: URL, configuration: SFSpeechLanguageModel.Configuration) async throws
```

## Parameters

- `asset`: The URL of a file containing custom training data. Create this file with doc://com.apple.speech/documentation/Speech/SFCustomLanguageModelData/export(to:).
- `configuration`: An object listing the URLs at which this method should create the language model and compiled vocabulary from the training data.
- `completion`: Called when the language model has been created.

## See Also

### Creating a custom language model

- [prepareCustomLanguageModel(for:configuration:ignoresCache:completion:)](speech/sfspeechlanguagemodel/preparecustomlanguagemodel(for:configuration:ignorescache:completion:).md)
- [SFSpeechLanguageModel.Configuration](speech/sfspeechlanguagemodel/configuration.md)
