Commit Graph

13 Commits

Author SHA1 Message Date
Yuki Bobier Koshimizu
b8c13e4c01 Refactor streamReader: Replace goto Statement with Loop in Recv Method (#339)
* test: Add tests for improved coverage before refactoring

This commit adds tests to improve coverage before refactoring
to ensure that the changes do not break anything.

* refactor: replace goto statement with loop

This commit introduces a refactor to improve the clarity of the control flow within the method.
The goto statement can sometimes make the code hard to understand and maintain, hence this refactor aims to resolve that.

* refactor: extract for-loop from Recv to another method

This commit improves code readability and maintainability
by making the Recv method simpler.
2023-06-08 19:31:25 +04:00
渡邉祐一 / Yuichi Watanabe
1394329e44 move error_accumulator into internal pkg (#304) (#335)
* move error_accumulator into internal pkg (#304)

* move error_accumulator into internal pkg (#304)

* add a test for ErrTooManyEmptyStreamMessages in stream_reader (#304)
2023-06-05 18:35:46 +04:00
Liu Shuang
d6ab1b3a4f fix: chat stream resp error (#259) 2023-04-19 13:05:00 +01:00
rex posadas
8e3a04664e Refactor/internal testing (#194)
* added NoError check

* corrected NoError

* has error checks

* replace more checks

* Used checks test helper

* Used checks test helper

* remove duplicate import

* fixed lint issues regarding length of messages

---------

Co-authored-by: Rex Posadas <rposadas@redwoodlogistics.com>
2023-03-24 21:55:25 +04:00
Jo
2ebb265e71 refactor: Refactor endpoint and model compatibility check (#180)
* Add model check for chat stream

* Sync model checks

* Fix typo

* Fix functino

* refactor: Refactor endpoint and model compatibility check

* apply review suggestions

* minor fix

* invert return boolean flag

* fix test
2023-03-22 17:46:08 +04:00
Liu Shuang
a5a945ad14 fix: stream return EOF when openai return error (#184)
* fix: stream return EOF when openai return error

* perf: add error accumulator

* fix: golangci-lint

* fix: unmarshal error possibly null

* fix: error accumulator

* test: error accumulator use interface and add test code

* test: error accumulator add test code

* refactor: use stream reader to re-use stream code

* refactor: stream reader use generics
2023-03-22 09:32:47 +04:00
sashabaranov
a8acb5f63b Add tests (#171)
* test models listing

* remove non-needed method

* test for .streamFinished

* add more error tests

* improve stream testing

* fix typo
2023-03-16 19:10:27 +04:00
Alexander Baranov
9eea94730a rename internally 2023-03-04 15:29:42 +04:00
sashabaranov
47887bf123 Rename and update docs (#120) 2023-03-04 15:18:43 +04:00
sashabaranov
ae05ed976f handle stream completion (#86)
* handle stream completion

* fix tests
2023-02-22 12:33:25 +04:00
sashabaranov
1eb5d625f8 Better configuration (#79)
* Configurable Transport (#75)

* new functions to allow HTTPClient configuration

* updated go.mod for testing from remote

* updated go.mod for remote testing

* revert go.mod replace directives

* Fixed NewOrgClientWithTransport comment

* Make client fully configurable

* make empty messages limit configurable #70 #71

* make auth token private in config

* add docs

* lint

---------

Co-authored-by: Michael Fox <m.will.fox@gmail.com>
2023-02-21 00:16:44 +04:00
Rascal0814
5191ea6f55 Modify the test module, add the file upload test, and add the image edit api (#63)
* Modify the test module, add the file upload test, and add the image editing api

* fix golangci-lint

* fix golangci-lint

* Static file deletion, file directory name modification

* fix

* test-server-related logic encapsulated in a single tidy
 struct

---------

Co-authored-by: julian_huang <julian.huang@yuansuan.com>
2023-02-11 22:51:53 +04:00
sashabaranov
6758ec4d96 Streaming support (#61)
* Add streaming support feature (#54)

* Add streaming support feature

removes golangci linting deprecation warnings
See: [Issue #49](https://github.com/sashabaranov/go-gpt3/issues/49)

* remove dead token

* Remove the goroutines from previous implementation

Set up separate test and file for streaming support
Add client code under cmd dir

* Supress CI errors

Need to update import path to test under feature/streaming-support
branch

* suppress linting errors

---------

Co-authored-by: sashabaranov <677093+sashabaranov@users.noreply.github.com>

* remove main.go

* remove code duplication

* use int64

* finalize streaming support

* lint

* fix tests

---------

Co-authored-by: e. alvarez <55966724+ealvar3z@users.noreply.github.com>
2023-02-07 20:42:53 +04:00