🚀 PIG AI 新版来袭:AI能力全面升级! 点击了解一下?
在 Spring AI 中使用 Testcontainers
<dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-testcontainers</artifactId> <scope>test</scope> </dependency>
@SpringBootTest class MyAITest { @Container static OllamaContainer ollama = new OllamaContainer(); @Test void testWithOllama() { // 在此处编写测试代码 } }
@Container static OllamaContainer ollama = new OllamaContainer() .withModel("llama2") .withPort(11434);