mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 17:48:40 +08:00
42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
/*
|
|
* Copyright (c) 2025 Hutool Team and hutool.cn
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import cn.hutool.ai.AIServiceFactory;
|
|
import cn.hutool.ai.ModelName;
|
|
import cn.hutool.ai.core.AIConfigBuilder;
|
|
import cn.hutool.ai.core.AIService;
|
|
import cn.hutool.ai.model.deepseek.DeepSeekService;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
|
class AIServiceFactoryTest {
|
|
|
|
String key = "your key";
|
|
|
|
@Test
|
|
void getAIService() {
|
|
final AIService aiService = AIServiceFactory.getAIService(new AIConfigBuilder(ModelName.DEEPSEEK.getValue()).setApiKey(key).build());
|
|
assertNotNull(aiService);
|
|
}
|
|
|
|
@Test
|
|
void testGetAIService() {
|
|
final DeepSeekService deepSeekService = AIServiceFactory.getAIService(new AIConfigBuilder(ModelName.DEEPSEEK.getValue()).setApiKey(key).build(), DeepSeekService.class);
|
|
assertNotNull(deepSeekService);
|
|
}
|
|
}
|