Spring Boot整合Google Bard - Web接口访问Google AI聊天机器人
之前开发了一个关于Google Bard
的Java库,可以帮助我们简单的提问并获得答案。现在我把它整合到Spring Boot
应用中,通过Web API让大家可以访问。
添加依赖
把pkslow google bard
添加到Spring Boot
项目中去:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.pkslow</groupId>
<artifactId>google-bard</artifactId>
<version>0.0.3</version>
</dependency>
</dependencies>
创建GoogleBardClient
在使用它之前,我们需要创建一个对应的GoogleBardClient
Bean: