Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes omitempty from stream chatcompletionrequest #436

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

Your issue may already be reported!
Please search on the [issue tracker](https://github.com/sashabaranov/go-openai/issues) before creating one.
Please search on the [issue tracker](https://github.com/odannyc/go-openai/issues) before creating one.

**Describe the bug**
A clear and concise description of what the bug is. If it's an API-related bug, please provide relevant endpoint(s).
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

Your issue may already be reported!
Please search on the [issue tracker](https://github.com/sashabaranov/go-openai/issues) before creating one.
Please search on the [issue tracker](https://github.com/odannyc/go-openai/issues) before creating one.

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A similar PR may already be submitted!
Please search among the [Pull request](https://github.com/sashabaranov/go-openai/pulls) before creating one.
Please search among the [Pull request](https://github.com/odannyc/go-openai/pulls) before creating one.

If your changes introduce breaking changes, please prefix the title of your pull request with "[BREAKING_CHANGES]". This allows for clear identification of such changes in the 'What's Changed' section on the release page, making it developer-friendly.

Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Go OpenAI
[![Go Reference](https://pkg.go.dev/badge/github.com/sashabaranov/go-openai.svg)](https://pkg.go.dev/github.com/sashabaranov/go-openai)
[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-openai)](https://goreportcard.com/report/github.com/sashabaranov/go-openai)
[![Go Reference](https://pkg.go.dev/badge/github.com/odannyc/go-openai.svg)](https://pkg.go.dev/github.com/odannyc/go-openai)
[![Go Report Card](https://goreportcard.com/badge/github.com/odannyc/go-openai)](https://goreportcard.com/report/github.com/odannyc/go-openai)
[![codecov](https://codecov.io/gh/sashabaranov/go-openai/branch/master/graph/badge.svg?token=bCbIfHLIsW)](https://codecov.io/gh/sashabaranov/go-openai)

This library provides unofficial Go clients for [OpenAI API](https://platform.openai.com/). We support:
Expand All @@ -12,7 +12,7 @@ This library provides unofficial Go clients for [OpenAI API](https://platform.op

### Installation:
```
go get github.com/sashabaranov/go-openai
go get github.com/odannyc/go-openai
```
Currently, go-openai requires Go version 1.18 or greater.

Expand All @@ -24,7 +24,7 @@ package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -76,7 +76,7 @@ import (
"errors"
"fmt"
"io"
openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -129,7 +129,7 @@ package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -162,7 +162,7 @@ import (
"context"
"fmt"
"io"
openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -211,7 +211,7 @@ import (
"context"
"fmt"

openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -243,7 +243,7 @@ import (
"fmt"
"os"

openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -284,7 +284,7 @@ import (
"context"
"encoding/base64"
"fmt"
openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
"image/png"
"os"
)
Expand Down Expand Up @@ -372,7 +372,7 @@ config.HTTPClient = &http.Client{
c := openai.NewClientWithConfig(config)
```

See also: https://pkg.go.dev/github.com/sashabaranov/go-openai#ClientConfig
See also: https://pkg.go.dev/github.com/odannyc/go-openai#ClientConfig
</details>

<details>
Expand All @@ -388,7 +388,7 @@ import (
"os"
"strings"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -442,7 +442,7 @@ import (
"context"
"fmt"

openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -489,7 +489,7 @@ import (
"context"
"fmt"

openai "github.com/sashabaranov/go-openai"
openai "github.com/odannyc/go-openai"
)

func main() {
Expand Down Expand Up @@ -629,7 +629,7 @@ If the `OPENAI_TOKEN` environment variable is not available, integration tests w

## Thank you

We want to take a moment to express our deepest gratitude to the [contributors](https://github.com/sashabaranov/go-openai/graphs/contributors) and sponsors of this project:
We want to take a moment to express our deepest gratitude to the [contributors](https://github.com/odannyc/go-openai/graphs/contributors) and sponsors of this project:
- [Carson Kahn](https://carsonkahn.com) of [Spindle AI](https://spindleai.com)

To all of you: thank you. You've helped us achieve more than we ever imagined possible. Can't wait to see where we go next, together!
6 changes: 3 additions & 3 deletions api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"os"
"testing"

. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
"github.com/sashabaranov/go-openai/jsonschema"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"
"github.com/odannyc/go-openai/jsonschema"
)

func TestAPI(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"os"

utils "github.com/sashabaranov/go-openai/internal"
utils "github.com/odannyc/go-openai/internal"
)

// Whisper Defines the models provided by OpenAI to use when processing audio with OpenAI.
Expand Down
6 changes: 3 additions & 3 deletions audio_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"strings"
"testing"

. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test"
"github.com/odannyc/go-openai/internal/test/checks"
)

// TestAudio Tests the transcription and translation endpoints of the API using the mocked server.
Expand Down
4 changes: 2 additions & 2 deletions audio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"path/filepath"
"testing"

"github.com/sashabaranov/go-openai/internal/test"
"github.com/sashabaranov/go-openai/internal/test/checks"
"github.com/odannyc/go-openai/internal/test"
"github.com/odannyc/go-openai/internal/test/checks"
)

func TestAudioWithFailingFormBuilder(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type ChatCompletionRequest struct {
Temperature float32 `json:"temperature,omitempty"`
TopP float32 `json:"top_p,omitempty"`
N int `json:"n,omitempty"`
Stream bool `json:"stream,omitempty"`
Stream bool `json:"stream"`
Stop []string `json:"stop,omitempty"`
PresencePenalty float32 `json:"presence_penalty,omitempty"`
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions chat_stream_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openai_test

import (
. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"

"context"
"encoding/json"
Expand Down
6 changes: 3 additions & 3 deletions chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"testing"
"time"

. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
"github.com/sashabaranov/go-openai/jsonschema"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"
"github.com/odannyc/go-openai/jsonschema"
)

func TestChatCompletionsWrongModel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"strings"

utils "github.com/sashabaranov/go-openai/internal"
utils "github.com/odannyc/go-openai/internal"
)

// Client is OpenAI GPT-3 API client.
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"testing"

"github.com/sashabaranov/go-openai/internal/test"
"github.com/odannyc/go-openai/internal/test"
)

var errTestRequestBuilderFailed = errors.New("test request builder failed")
Expand Down
4 changes: 2 additions & 2 deletions completion_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openai_test

import (
. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"

"context"
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package openai_test
import (
"testing"

. "github.com/sashabaranov/go-openai"
. "github.com/odannyc/go-openai"
)

func TestGetAzureDeploymentByModel(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions edits_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openai_test

import (
. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"

"context"
"encoding/json"
Expand Down
4 changes: 2 additions & 2 deletions embeddings_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openai_test

import (
. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"

"bytes"
"context"
Expand Down
4 changes: 2 additions & 2 deletions engines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http"
"testing"

. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"
)

// TestGetEngine Tests the retrieve engine endpoint of the API using the mocked server.
Expand Down
4 changes: 2 additions & 2 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) {
err = json.Unmarshal(rawMap["message"], &e.Message)
if err != nil {
// If the parameter field of a function call is invalid as a JSON schema
// refs: https://github.com/sashabaranov/go-openai/issues/381
// refs: https://github.com/odannyc/go-openai/issues/381
var messages []string
err = json.Unmarshal(rawMap["message"], &messages)
if err != nil {
Expand All @@ -53,7 +53,7 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) {
}

// optional fields for azure openai
// refs: https://github.com/sashabaranov/go-openai/issues/343
// refs: https://github.com/odannyc/go-openai/issues/343
if _, ok := rawMap["type"]; ok {
err = json.Unmarshal(rawMap["type"], &e.Type)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"testing"

. "github.com/sashabaranov/go-openai"
. "github.com/odannyc/go-openai"
)

func TestAPIErrorUnmarshalJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"net/url"
"os"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func Example() {
Expand Down
2 changes: 1 addition & 1 deletion examples/chatbot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/completion/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"os"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/images/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"os"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/voice-to-text/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/sashabaranov/go-openai"
"github.com/odannyc/go-openai"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions files_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"testing"
"time"

. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test/checks"
. "github.com/odannyc/go-openai"
"github.com/odannyc/go-openai/internal/test/checks"
)

func TestFileUpload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions files_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openai //nolint:testpackage // testing private field

import (
utils "github.com/sashabaranov/go-openai/internal"
"github.com/sashabaranov/go-openai/internal/test/checks"
utils "github.com/odannyc/go-openai/internal"
"github.com/odannyc/go-openai/internal/test/checks"

"context"
"fmt"
Expand Down
Loading