【问题解决】Spring-AI聊天接口报错Error while extracting response for type OpenAiApi$ChatCompletion

问题描述

今天在学习Spring-AI的时,调用openAiChatModel.call(message)方法时,遇到了这个错误

Error while extracting response for type [org.springframework.ai.openai.api.OpenAiApi$ChatCompletion] and content type [application/json;charset=utf-8]
org.springframework.web.client.RestClientException: Error while extracting response for type [org.springframework.ai.openai.api.OpenAiApi$ChatCompletion] and content type [application/json;charset=utf-8]

解决方案

项目中添加该依赖


    org.apache.httpcomponents.client5
    httpclient5
    5.2.1

参考

https://stackoverflow.com/questions/78121525/spring-ai-openai-error-extracting-response-of-type-openaiapiembeddinglist

你可能感兴趣的:(问题解决,spring,人工智能,java)