spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.16k stars 786 forks source link

Documentation: Correct response key from "generation" to "completion" in example code #1533

Closed LuizyHub closed 1 week ago

LuizyHub commented 1 week ago

Bug description The example code in the documentation for Spring AI currently labels the response key as "generation" in a curl command example. However, the correct key should be "completion" to match the actual API response format. https://docs.spring.io/spring-ai/reference/api/chatclient.html

Environment

Steps to reproduce

  1. Configure the ChatClient as shown in the documentation example.
  2. Start the Spring application and make a request to the /ai/simple endpoint using curl localhost:8080/ai/simple.
  3. Observe the response key, which is labeled "generation" instead of the expected "completion".

Expected behavior The response should use "completion" as the key to accurately reflect the API response format.

Minimal Complete Reproducible example The issue can be reproduced by using the example configuration in the documentation. The curl command will output:

{"generation": "Why did the pirate go to the comedy club? To hear some arrr-rated jokes! Arrr, matey!"}

but should output:

{"completion": "Why did the pirate go to the comedy club? To hear some arrr-rated jokes! Arrr, matey!"}

Thank you for reviewing this issue!

LuizyHub commented 1 week ago

Here is my Pull Request #1534

LuizyHub commented 1 week ago

solved #1534