Add support for reasoning_content field in chat completion messages for DeepSeek R1 (#925)

* support deepseek field "reasoning_content"

* support deepseek field "reasoning_content"

* Comment ends in a period (godot)

* add comment on field reasoning_content

* fix go lint error

* chore: trigger CI

* make field "content" in MarshalJSON function omitempty

* remove reasoning_content in TestO1ModelChatCompletions func

* feat: Add test and handler for deepseek-reasoner chat model completions, including support for reasoning content in responses.

* feat: Add test and handler for deepseek-reasoner chat model completions, including support for reasoning content in responses.

* feat: Add test and handler for deepseek-reasoner chat model completions, including support for reasoning content in responses.
This commit is contained in:
goodenough
2025-04-29 21:24:45 +08:00
committed by GitHub
parent 658beda2ba
commit 306fbbbe6f
4 changed files with 128 additions and 33 deletions

View File

@@ -29,7 +29,7 @@ func setupAzureTestServer() (client *openai.Client, server *test.ServerTest, tea
// numTokens Returns the number of GPT-3 encoded tokens in the given text.
// This function approximates based on the rule of thumb stated by OpenAI:
// https://beta.openai.com/tokenizer/
// https://beta.openai.com/tokenizer.
//
// TODO: implement an actual tokenizer for GPT-3 and Codex (once available).
func numTokens(s string) int {