import dev.langchain4j.model.azure.AzureOpenAiChatModel;
import dev.langchain4j.model.chat.ChatModel;
/**
* Azure OpenAI 模型
*/
public class AzureOpenAiIntegration {
/**
* 创建 Azure OpenAI 模型
*/
public static ChatModel createAzureModel(String endpoint,
String apiKey,
String deploymentName) {
return AzureOpenAiChatModel.builder()
.endpoint(endpoint)
.apiKey(apiKey)
.deploymentName(deploymentName)
.modelName(deploymentName)
.temperature(0.7)
.maxTokens(1000)
.timeout(Duration.ofSeconds(60))
.logRequests(true)
.logResponses(true)
.build();
}
/**
* Azure 配置
*/
public static class AzureConfig {
private final String endpoint;
private final String apiKey;
private final String deploymentName;
public AzureConfig(String endpoint, String apiKey, String deploymentName) {
this.endpoint = endpoint;
this.apiKey = apiKey;
this.deploymentName = deploymentName;
}
public String getEndpoint() { return endpoint; }
public String getApiKey() { return apiKey; }
public String getDeploymentName() { return deploymentName; }
}
}