Skip to content

同步主仓库 #992

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test/checks"
"github.com/lantiancai/go-openai/jsonschema"
)

func TestAPI(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions assistant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package openai_test
import (
"context"

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

"encoding/json"
"fmt"
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/lantiancai/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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test"
"github.com/lantiancai/go-openai/internal/test/checks"
)

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

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

func TestAudioWithFailingFormBuilder(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"reflect"
"testing"

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

func TestUploadBatchFile(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions chat_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ type ChatCompletionTokenLogprobTopLogprob struct {
Logprob float64 `json:"logprob"`
}

type MessageData struct {
Role string `json:"role"`
Content string `json:"content"`
}
type ChatCompletionStreamChoice struct {
Index int `json:"index"`
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
Logprobs *ChatCompletionStreamChoiceLogprobs `json:"logprobs,omitempty"`
FinishReason FinishReason `json:"finish_reason"`
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
// sb sentence
Message MessageData `json:"message,omitempty"`
}

type PromptFilterResult struct {
Expand Down
4 changes: 2 additions & 2 deletions chat_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strconv"
"testing"

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

func TestChatCompletionsStreamWrongModel(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test/checks"
"github.com/lantiancai/go-openai/jsonschema"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/url"
"strings"

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

// Client is OpenAI GPT-3 API client.
Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"reflect"
"testing"

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

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
Expand Up @@ -12,8 +12,8 @@ import (
"testing"
"time"

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

func TestCompletionsWrongModel(t *testing.T) {
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/lantiancai/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
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

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

// TestEdits Tests the edits endpoint of the API using the mocked server.
Expand Down
4 changes: 2 additions & 2 deletions embeddings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"reflect"
"testing"

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

func TestEmbedding(t *testing.T) {
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/lantiancai/go-openai"
"github.com/lantiancai/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 @@ -54,7 +54,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/lantiancai/go-openai/issues/381
var messages []string
err = json.Unmarshal(rawMap["message"], &messages)
if err != nil {
Expand All @@ -64,7 +64,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/lantiancai/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 @@ -6,7 +6,7 @@ import (
"reflect"
"testing"

"github.com/sashabaranov/go-openai"
"github.com/lantiancai/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/lantiancai/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/lantiancai/go-openai"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/completion-with-tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"os"

"github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/jsonschema"
"github.com/lantiancai/go-openai"
"github.com/lantiancai/go-openai/jsonschema"
)

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/lantiancai/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/lantiancai/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/lantiancai/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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test/checks"
)

func TestFileBytesUpload(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"os"
"testing"

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

func TestFileBytesUploadWithFailingFormBuilder(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions fine_tunes_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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test/checks"
)

const testFineTuneID = "fine-tune-id"
Expand Down
4 changes: 2 additions & 2 deletions fine_tuning_job_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/lantiancai/go-openai"
"github.com/lantiancai/go-openai/internal/test/checks"
)

const testFineTuninigJobID = "fine-tuning-job-id"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/sashabaranov/go-openai
module github.com/lantiancai/go-openai

go 1.18
4 changes: 2 additions & 2 deletions image_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"testing"
"time"

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

func TestImages(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions image_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/lantiancai/go-openai/internal"
"github.com/lantiancai/go-openai/internal/test/checks"

"context"
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions internal/error_accumulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"testing"

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

func TestErrorAccumulatorBytes(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/form_builder_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package openai //nolint:testpackage // testing private field

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

"bytes"
"errors"
Expand Down
2 changes: 1 addition & 1 deletion internal/test/helpers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package test

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

"net/http"
"os"
Expand Down
2 changes: 1 addition & 1 deletion jsonschema/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/sashabaranov/go-openai/jsonschema"
"github.com/lantiancai/go-openai/jsonschema"
)

func TestDefinition_MarshalJSON(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion jsonschema/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jsonschema_test
import (
"testing"

"github.com/sashabaranov/go-openai/jsonschema"
"github.com/lantiancai/go-openai/jsonschema"
)

func Test_Validate(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"net/http"
"testing"

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

var emptyStr = ""
Expand Down
Loading
Loading