383 Commits

Author SHA1 Message Date
VaalaCat
2436e7afb8 feat: add reasoning format 2025-06-15 12:59:44 +00:00
VaalaCat
67f3b169df feat: add include_reasoning 2025-06-15 12:59:08 +00:00
VaalaCat
3640274cd1 feat: change repo name 2025-06-15 12:58:45 +00:00
JT A.
ff9d83a485 skip json field (#1009)
* skip json field

* backfill some coverage and tests
2025-05-29 11:31:35 +01:00
Axb12
8c65b35c57 update image api *os.File to io.Reader (#994)
* update image api *os.File to io.Reader

* update code style

* add reader test

* supplementary reader test

* update the reader in the form builder test

* add commnet

* update comment

* update code style
2025-05-20 14:45:40 +01:00
Alex Baranov
4d2e7ab29d fix lint (#998) 2025-05-13 12:59:06 +01:00
Justa
6aaa732296 add ChatTemplateKwargs to ChatCompletionRequest (#980)
Co-authored-by: Justa <justa.cai@akuvox.com>
2025-05-13 12:52:44 +01:00
Pedro Chaparro
0116f2994d feat: add support for image generation using gpt-image-1 (#971)
* feat: add gpt-image-1 support

* feat: add example to generate image using gpt-image-1 model

* style: missing period in comments

* feat: add missing fields to example

* docs: add GPT Image 1 to README

* revert: keep `examples/images/main.go` unchanged

* docs: remove unnecessary newline from example in README file
2025-05-13 12:51:08 +01:00
Alex Baranov
8ba38f6ba1 remove backup file (#996) 2025-05-13 12:44:16 +01:00
Alex Baranov
6181facea7 update codecov action, pass token (#987) 2025-05-04 15:45:40 +01:00
Alex Baranov
77ccac8d34 Upgrade golangci-lint to 2.1.5 (#986)
* Upgrade golangci-lint to 2.1.5

* update action
2025-05-03 22:39:47 +01:00
Alex Baranov
5ea214a188 Improve unit test coverage (#984)
* add tests for config

* add audio tests

* lint

* lint

* lint
2025-05-03 22:25:14 +01:00
Ben Katz
d65f0cb54e Fix: Corrected typo in O4Mini20250416 model name and endpoint map. (#981) 2025-05-03 21:44:48 +01:00
Daniel Peng
93a611cf4f Add Prediction field (#970)
* Add Prediction field to ChatCompletionRequest

* Include prediction tokens in response
2025-04-29 14:38:27 +01:00
Oleksandr Redko
6836cf6a6f Remove redundant typecheck linter (#955) 2025-04-29 14:36:38 +01:00
Sean McGinnis
da5f9bc9bc Add CompletionRequest.StreamOptions (#959)
The legacy completion API supports a `stream_options` object when
`stream` is set to true [0]. This adds a StreamOptions property to the
CompletionRequest struct to support this setting.

[0] https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options

Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2025-04-29 14:35:26 +01:00
rory malcolm
bb5bc27567 Add support for 4o-mini and 3o (#968)
- This adds supports, and tests, for the 3o and 4o-mini class of models
2025-04-29 14:34:33 +01:00
Zhongxian Pan
4cccc6c934 Adapt different stream data prefix, with or without space (#945) 2025-04-29 14:29:15 +01:00
goodenough
306fbbbe6f 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.
2025-04-29 14:24:45 +01:00
netr
658beda2ba feat: Add missing TTS models and voices (#958)
* feat: Add missing TTS models and voices

* feat: Add new instruction field to create speech request

- From docs: Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.

* fix: add canary-tts back to SpeechModel
2025-04-26 11:13:43 +01:00
Takahiro Ikeuchi
d68a683815 feat: add new GPT-4.1 model variants to completion.go (#966)
* feat: add new GPT-4.1 model variants to completion.go

* feat: add tests for unsupported models in completion endpoint

* fix: add missing periods to test function comments in completion_test.go
2025-04-23 22:50:47 +01:00
JT A.
e99eb54c9d add enum tag to jsonschema (#962)
* fix jsonschema tests

* ensure all run during PR Github Action

* add test for struct to schema

* add support for enum tag

* support nullable tag
2025-04-13 19:00:48 +01:00
Liu Shuang
74d6449f22 feat: add gpt-4.5-preview models (#947) 2025-03-04 08:26:59 +00:00
Alex Baranov
261721bfdb Fix linter (#943)
* fix lint

* remove linters
2025-02-25 16:56:35 +00:00
Dan Ackerson
be2e2387d4 feat: add Anthropic API support with custom version header (#934)
* feat: add Anthropic API support with custom version header

* refactor: use switch statement for API type header handling

* refactor: add OpenAI & AzureAD types to be exhaustive

* Update client.go

need explicit fallthrough in empty case statements

* constant for APIVersion; addtl tests
2025-02-25 11:03:38 +00:00
Liu Shuang
85f578b865 fix: remove validateO1Specific (#939)
* fix: remove validateO1Specific

* update golangci-lint-action version

* fix actions

* fix actions

* fix actions

* fix actions

* remove some o1 test
2025-02-17 11:29:18 +00:00
Liu Shuang
c0a9a75fe0 feat: add developer role (#936) 2025-02-12 15:05:44 +00:00
Mazyar Yousefiniyae shad
a62919e8c6 ref: add image url support to messages (#933)
Some checks failed
Integration tests / Run integration tests (push) Has been cancelled
Sanity check / Sanity check (push) Has been cancelled
* ref: add image url support to messages

* fix linter error

* fix linter error
2025-02-09 18:36:44 +00:00
rory malcolm
2054db016c Add support for O3-mini (#930)
* Add support for O3-mini

- Add support for the o3 mini set of models, including tests that match the constraints in OpenAI's API docs (https://platform.openai.com/docs/models#o3-mini).

* Deprecate and refactor

- Deprecate `ErrO1BetaLimitationsLogprobs` and `ErrO1BetaLimitationsOther`

- Implement `validationRequestForReasoningModels`, which works on both o1 & o3, and has per-model-type restrictions on functionality (eg, o3 class are allowed function calls and system messages, o1 isn't)

* Move reasoning validation to `reasoning_validator.go`

- Add a `NewReasoningValidator` which exposes a `Validate()` method for a given request

- Also adds a test for chat streams

* Final nits
2025-02-06 14:53:19 +00:00
saileshd1402
45aa99607b Make "Content" field in "ChatCompletionMessage" omitempty (#926) 2025-01-31 19:05:29 +00:00
Trevor Creech
9823a8bbbd Chat Completion API: add ReasoningEffort and new o1 models (#928)
* add reasoning_effort param

* add o1 model

* fix lint
2025-01-31 18:57:57 +00:00
Oleksandr Redko
7a2915a37d Simplify tests with T.TempDir (#929) 2025-01-31 18:55:41 +00:00
Sabuhi Gurbani
2a0ff5ac63 Added additional_messages (#914) 2024-12-27 10:01:16 +00:00
Alex Baranov
56a9acf86f Ignore test.mp3 (#913) 2024-12-08 13:16:48 +00:00
Tim Misiak
af5355f5b1 Fix ID field to be optional (#911)
The ID field is not always present for streaming responses. Without omitempty, the entire ToolCall struct will be missing.
2024-12-08 13:12:05 +00:00
Qiying Wang
c203ca001f feat: add RecvRaw (#896) 2024-11-30 10:29:05 +00:00
Liu Shuang
21fa42c18d feat: add gpt-4o-2024-11-20 model (#905) 2024-11-30 09:39:47 +00:00
nagar-ajay
74ed75f291 Make user field optional in embedding request (#899)
* make user optional in embedding request

* fix unit test
2024-11-20 20:39:44 +00:00
LinYushen
1687616165 o1 model support stream (#904) 2024-11-20 20:26:10 +00:00
Ayush Sawant
b3ece4d32e Updated client_test to solve lint error (#900)
* updated client_test to solve lint error

* modified golangci yml to solve linter issues

* minor change
2024-11-19 20:37:10 +00:00
Denny Depok
6d066bb12d Support Attachments in MessageRequest (#890)
* add attachments in MessageRequest

* Move tools const to message

* remove const, just use assistanttool const
2024-11-08 13:54:27 +00:00
Matt Davis
f5e6e0e4fe Added Vector Store File List properties that allow for pagination (#891) 2024-11-08 13:53:02 +00:00
genglixia
d10f1b8199 add chatcompletion stream delta refusal and logprobs (#882)
* add chatcompletion stream refusal and logprobs

* fix slice to struct

* add  integration test

* fix lint

* fix lint

* fix: the object should be pointer

---------

Co-authored-by: genglixia <genglixia@enjoypartytime.com>
2024-10-29 07:22:52 +00:00
Ayush Sawant
6e087322b7 Updated checkPromptType function to handle prompt list in completions (#885)
* updated checkPromptType function to handle prompt list in completions

* removed generated test file

* added corresponding unit testcases

* Updated to use less nesting with early returns
2024-10-25 14:41:45 +01:00
Edin Ćoralić
3672c0dec6 fix: Updated Assistent struct with latest fields based on OpenAI docs (#883) 2024-10-21 21:57:02 +01:00
Ayush Sawant
fb15ff9dcd Handling for non-json response (#881)
* removed handling for non-json response

* added response body in RequestError.Error() and updated tests

* done linting
2024-10-21 21:49:34 +01:00
Sander Mack-Crane
9fe2c6ce1f Completion API: add Store and Metadata parameters (#878) 2024-10-15 21:16:57 +01:00
Alex Baranov
b162541513 Cleanup (#879)
* remove obsolete files

* update readme
2024-10-15 20:09:34 +01:00
Matt Jacobs
21f7134574 Adding new moderation model constants (#875) 2024-10-14 14:21:39 +01:00
Ayush Sawant
cfe15ffd00 return response body as byte slice for RequestError type (#873) 2024-10-14 14:20:39 +01:00