Skip to content

merge main branch - #1

Open
Leizhenpeng wants to merge 265 commits into
ConnectAI-E:masterfrom
sashabaranov:master
Open

merge main branch#1
Leizhenpeng wants to merge 265 commits into
ConnectAI-E:masterfrom
sashabaranov:master

Conversation

@Leizhenpeng

Copy link
Copy Markdown
Member

No description provided.

vvatanabe and others added 30 commits June 12, 2023 17:40
Added GPT3Dot5Turbo0613, GPT3Dot5Turbo16K, GPT40613, and GPT432K0613
models from June update
(https://openai.com/blog/function-calling-and-other-api-updates)

Issue #360
* Improve (#356) to support registration of wildcard URLs

* Add TestAzureChatCompletions & TestAzureChatCompletionsWithCustomDeploymentName

* Remove TestAzureChatCompletionsWithCustomDeploymentName

---------

Co-authored-by: coggsflod <richard.coggins@officedepot.com>
* add 16k_0613 model

* add 16k_0613 model

* add model:
* feat(chat): support function call api

* rename struct & add const ChatMessageRoleFunction
* add items, which is required for array type

* use JSONSchemaDefine directly
* audio: add items to AudioResponseFormat enum

* audio: expand AudioResponse struct to accommodate verbose json response

---------

Co-authored-by: Roman Zubov <rzubov@aintsys.com>
* fix: chat stream resp has 'data: ' prefix

* fix: lint error

* fix: lint error

* fix: lint error
* feat: use json.rawMessage, test functions

* chore: lint

* fix: tests

the ChatCompletion mock server doesn't actually run otherwise. N=0
is the default request but the server will treat it as n=1

* fix: tests should default to n=1 completions

* chore: add back removed interfaces, custom marshal

* chore: lint

* chore: lint

* chore: add some tests

* chore: appease lint

* clean up JSON schema + tests

* chore: lint

* feat: remove backwards compatible functions

for illustrative purposes

* fix: revert params change

* chore: use interface{}

* chore: add test

* chore: add back FunctionDefine

* chore: /s/interface{}/any

* chore: add back jsonschemadefinition

* chore: testcov

* chore: lint

* chore: remove pointers

* chore: update comment

* chore: address CR

added test for compatibility as well

---------

Co-authored-by: James <jmacwhyte@MacBooger-II.local>
* refactoring http request creation and sending

* fix lint error

* increase the test coverage of client.go

* refactor: Change the style of HTTPRequestBuilder.Build func to one-argument-per-line.
* move json schema to directory/package

* added jsonschema to README
…chema missing properties (#419)

Co-authored-by: Rick <medivhzhan@icloud.com>
* Allow raw tokens to be used as embedding input

* fix linting issues (lines too long)

* add endpoint test for embedding from tokens

* remove redundant comments

* fix comment to match new param name

* change interface to any

* Rename methods and implement convert for base req

* add comments to CreateEmbeddings

* update tests

* shorten line length

* rename parameter
* docs: added instructions for obtaining OpenAI API key to README

* docs: move 'Getting an OpenAI API key' before 'Other examples'
jtarchie and others added 30 commits May 29, 2025 11:31
* skip json field

* backfill some coverage and tests
* fix image api missing filename bug

* add test

* add test

* update test
…r tests (#999)

* test: enhance error accumulator and form builder tests, add marshaller tests

* test: fix some issue form golangci-lint

* test: gofmt form builder test

* fix

* fix

* fix lint
* Fix for #1021:
1. Make Usage field in completions Response to pointer.

* Fix for #1021:
1. Make Usage field in completions Response to pointer.
2. Add omitempty to json tag

Signed-off-by: Hritik003 <hritik.raj@nutanix.com>

---------

Signed-off-by: Hritik003 <hritik.raj@nutanix.com>
…ONSchema.schema (#1028)

* feat: #1027

* add tests

* feat: #1027

* feat: #1027

* feat: #1027

* update chat_test.go

* feat: #1027

* add test cases
* Add support for Chat Completion Service Tier

* Add priority service tier
* support $ref and $defs in JSON Schema

* update
* Add unit tests to improve coverage

* Fix type assertion checks in tests
* support $ref and $defs in JSON Schema

* update

* removed root $ref from JSON Schema

* Update json.go

* Update json_test.go

* Update jsonschema/json.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update jsonschema/json.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* support for extra_body parameter for embeddings API

* done linting

* added unit tests

* improved code coverage and removed unnecessary checks

* test cleanup

* updated body map creation code

* code coverage

* minor change

* updated testcase comment
* test: expand jsonschema coverage

* test: fix package name for containsref tests
* Add unit tests for internal test utilities

* Fix lint issues in internal tests
* Add GuidedChoice to ChatCompletionRequest

* made separate NonOpenAIExtensions

* fixed lint issue

* renamed struct and removed inline json tag

* Update chat.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update chat.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Alex Baranov <677093+sashabaranov@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* add verbosity param to ChatCompletionRequest

* edit comment about verbosity
…based (#1079)

fixes #978

Signed-off-by: Christopher Petito <chrisjpetito@gmail.com>
* feat: add Responses API support

* docs: add comprehensive Responses API example

* docs: simplify Responses API example

* test: add Responses API integration coverage

* ignore .env

* ci: relax Codecov thresholds
* fix(images): send image edit fields

* test(images): isolate optional field write failures
…1108)

CreateFormFileReader only set Content-Type when the reader satisfied
the ContentType() string optional interface. The OpenAI audio
endpoints reject the file when that header is missing, so a plain
io.Reader passed through CreateTranscription was a 400 from the
server.

Derive a Content-Type from the filename extension via
mime.TypeByExtension, falling back to "application/octet-stream"
which is what the stdlib's multipart.Writer.CreateFormFile uses by
default. Readers that supply their own ContentType still win.

Fixes #1010.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
The unmarshaler can return a non-nil *ErrorResponse whose Error pointer
is nil: any payload that round-trips through Unmarshal (a buffered
partial frame on context cancel, a stray "{}", etc.) does it. processLines
then wrapped that nil with `fmt.Errorf("error, %w", respErr.Error)` and
the caller saw the famously useless "error, <nil>" message instead of
the actual io.EOF (or whatever the read error was).

Guard on respErr.Error != nil so the original read error gets returned
when there's no real API error to report.

Fixes #1060.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
Remove omitempty from the Stream field tag in ChatCompletionRequest
and CompletionRequest. Go's omitempty omits false for bool fields,
which means non-streaming requests never include "stream": false in
the serialized JSON. Some OpenAI-compatible endpoints (proxies, Azure
configurations) require the field to be explicitly present.

The streaming code path already sets Stream = true explicitly, so
this change only affects non-streaming requests, which now correctly
emit "stream": false.

Fixes #1073
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.