You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
I was experimenting on Spring AI and was looking for a free model for ChatApi implementation. Upon investigation I found I can use HuggingFace microsoft/Phi-3-mini-4k-instruct model. So, I added the following dependency in my project and started to investigate:
// POM version is 1.0.0-M3
implementation 'org.springframework.ai:spring-ai-huggingface-spring-boot-starter'
Unfortunately, The following exception was received:
org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found: "{"error":"Model microsoft/Phi-3-mini-4k-instruct/generate does not exist"}"
What I found is that, /generate postfix is appended in the code & hardcoded in org.springframework.ai.huggingface.api.TextGenerationInferenceApi#generateWithHttpInfo, line 83
Whereas, with postman everything works as expected as per hugging face documentation - https://huggingface.co/docs/api-inference/tasks/text-generation?code=curl
Environment
Java version - 21
Build tool - gradle 8.3
Spring AI version - 1.0.0-M3
Steps to reproduce
Just a simple ChatClient setup with hugging face model provided along with access key generated in hugging face account
Expected behavior
/generate is not hardcoded hence can put whatever url is needed
Minimal Complete Reproducible example
I can't put my access key here, but all you need to do is
Create a simple project
Add huggingface-ai dependency
Define hugging face url & access key in application properties file
Call the ChatClient
The text was updated successfully, but these errors were encountered:
- Update GenerateResponse content schema type to array at openapi.json
- Use CompatGenerateRequest instead of GenerateRequest for the TextGenerationInference API Request
Signed-off-by: jitokim <[email protected]>
Bug description
I was experimenting on Spring AI and was looking for a free model for ChatApi implementation. Upon investigation I found I can use HuggingFace
microsoft/Phi-3-mini-4k-instruct
model. So, I added the following dependency in my project and started to investigate:Similarly, I added in application yaml:
Once done, I called
HuggingfaceChatModel
Unfortunately, The following exception was received:
What I found is that, /generate postfix is appended in the code & hardcoded in org.springframework.ai.huggingface.api.TextGenerationInferenceApi#generateWithHttpInfo, line 83
Whereas, with postman everything works as expected as per hugging face documentation - https://huggingface.co/docs/api-inference/tasks/text-generation?code=curl
Environment
Java version - 21
Build tool - gradle 8.3
Spring AI version - 1.0.0-M3
Steps to reproduce
Just a simple ChatClient setup with hugging face model provided along with access key generated in hugging face account
Expected behavior
/generate is not hardcoded hence can put whatever url is needed
Minimal Complete Reproducible example
I can't put my access key here, but all you need to do is
The text was updated successfully, but these errors were encountered: