Class DashScopeTextEmbedding.Builder
java.lang.Object
io.agentscope.core.embedding.dashscope.DashScopeTextEmbedding.Builder
- Enclosing class:
- DashScopeTextEmbedding
Builder for DashScopeTextEmbedding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the API key for DashScope authentication.Sets a custom base URL for DashScope API.build()Builds the DashScopeTextEmbedding instance.dimensions(int dimensions) Sets the dimension of embedding vectors.executionConfig(io.agentscope.core.model.ExecutionConfig config) Sets the default execution configuration.Sets the model name to use.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
apiKey
Sets the API key for DashScope authentication.- Parameters:
apiKey- the API key- Returns:
- this builder instance
-
modelName
Sets the model name to use.- Parameters:
modelName- the model name (e.g., "text-embedding-v3")- Returns:
- this builder instance
-
dimensions
Sets the dimension of embedding vectors.- Parameters:
dimensions- the dimension- Returns:
- this builder instance
-
executionConfig
public DashScopeTextEmbedding.Builder executionConfig(io.agentscope.core.model.ExecutionConfig config) Sets the default execution configuration.- Parameters:
config- the execution config (null for defaults)- Returns:
- this builder instance
-
baseUrl
Sets a custom base URL for DashScope API.- Parameters:
baseUrl- the base URL (null for default)- Returns:
- this builder instance
-
build
Builds the DashScopeTextEmbedding instance.This method validates required parameters and ensures that the defaultExecutionConfig always has proper defaults applied using EmbeddingUtils.ensureDefaultExecutionConfig().
- Returns:
- configured DashScopeTextEmbedding instance
- Throws:
IllegalStateException- if required parameters are missing or invalid
-