EmbeddingModel that downloads/loads its underlying model asynchronously via a background task.
The constructor immediately schedules an UpdateEmbeddingModelTask. Call
embedAll(List) only once the model is ready (check isPresent()).
Does not listen to any preferences; the owner is responsible for reacting to preference changes and creating a new instance if needed.
Implements AutoCloseable; close it to release the loaded model.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private String | |
| private static final Logger | |
| private final EmbeddingModelMetadataService | |
| private final String | |
| private final NotificationService | |
| private final ObjectProperty | |
| private final TaskExecutor |
| Access | Constructor and Description |
|---|---|
| public | AsyncEmbeddingModel(String modelName, AiPreferences aiPreferences, NotificationService notificationService, TaskExecutor taskExecutor, EmbeddingModelMetadataService metadataService)
|
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public dev.langchain4j.model.output.Response | |
| public String | |
| public OptionalInt | |
| public String | |
| public boolean | |
| public boolean | |
| public void |
| closed | back to summary |
|---|---|
| private boolean closed | |
| errorWhileBuildingModel | back to summary |
|---|---|
| private String errorWhileBuildingModel | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| metadataService | back to summary |
|---|---|
| private final EmbeddingModelMetadataService metadataService | |
| modelName | back to summary |
|---|---|
| private final String modelName | |
| notificationService | back to summary |
|---|---|
| private final NotificationService notificationService | |
| predictorProperty | back to summary |
|---|---|
| private final ObjectProperty<Optional<DeepJavaEmbeddingModel>> predictorProperty | |
| taskExecutor | back to summary |
|---|---|
| private final TaskExecutor taskExecutor | |
| AsyncEmbeddingModel | back to summary |
|---|---|
| public AsyncEmbeddingModel(String modelName, AiPreferences aiPreferences, NotificationService notificationService, TaskExecutor taskExecutor, EmbeddingModelMetadataService metadataService) | |
| close | back to summary |
|---|---|
| public synchronized void close() Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| embedAll | back to summary |
|---|---|
public dev.langchain4j.model.output.Response
| |
| getErrorWhileBuildingModel | back to summary |
|---|---|
| public String getErrorWhileBuildingModel() | |
| getMaxSnippetTokens | back to summary |
|---|---|
| public OptionalInt getMaxSnippetTokens() | |
| getModelName | back to summary |
|---|---|
| public String getModelName() | |
| hadErrorWhileBuildingModel | back to summary |
|---|---|
| public boolean hadErrorWhileBuildingModel() | |
| isPresent | back to summary |
|---|---|
| public boolean isPresent() | |
| startRebuildingTask | back to summary |
|---|---|
| public void startRebuildingTask() | |