Commit Graph

27 Commits

Author SHA1 Message Date
渡邉祐一 / Yuichi Watanabe
e49d771fff support for parsing error response message fields even if they are arrays (#381) (#384) 2023-06-17 17:57:29 +04:00
渡邉祐一 / Yuichi Watanabe
b616090e69 refactoring tests with mock servers (#30) (#356) 2023-06-12 17:40:26 +04:00
Yuki Bobier
24aa2005cc test: remove httpbin dependency (#297)
Replace the use of external httpbin service in TestRequestError
with a local HTTP server using the net/http/httptest package.
This change improves test reliability by eliminating the dependency
on an external service.
2023-05-03 20:20:32 +04:00
Liu Shuang
d6ab1b3a4f fix: chat stream resp error (#259) 2023-04-19 13:05:00 +01:00
Stephen Young
061c97ef7e Implement Unmarshaller interface. Resolves #244 (#248) 2023-04-14 20:09:40 +02: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
Felix Yan
34f3a118df Correct typos in api_test.go (#172) 2023-03-17 22:58:34 +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
Constantine A
c5fe8742cc add "name" property for ChatCompletionMessage (#123) 2023-03-06 10:52:56 +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
c8261c5638 Add chat completions (#90) 2023-03-02 00:47: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
Marc Haisenko
ee3df71880 Improve error reporting (#68)
* Provide APIError and use Go's error wrapping

* Add generic request error

* Fix code formatting
2023-02-13 20:43:06 +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
sashabaranov
3695eb3ade use int64 timestamps everywhere (#59) 2023-01-28 23:18:59 +04:00
sashabaranov
b6e0908977 Run tests on PR (#57)
* run tests on PR

* fix tests+lint

* update linter config
2023-01-28 22:32:23 +04:00
sm2642
794a5512f6 -Added moderation endpoint test (#56)
-Rearrange some code

Co-authored-by: Shalin <shalinmehta85@gmail.com>
2023-01-28 22:25:38 +04:00
sashabaranov
cf013d3eb5 Remove default timeout and search API (#51)
* remove 1 minute timeout

* remove deprecated search api test

* remove search api
2023-01-07 00:22:39 +04:00
Andrew Poydence
2c55a49a34 Add Image generation API (#48) 2023-01-03 17:15:50 +04:00
Alexander Baranov
be08f204f0 Skip production API test by default 2022-08-11 15:41:37 +06:00
Oleg
d63df93c65 Add OpenAI Mock Server (#31)
* add constants for completions, refactor usage, add test server

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

* append v1 endpoint to test

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

* add makefile for easy targets

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

* lint files & add linter

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

* disable real API tests in short mode

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>
2022-08-11 15:29:23 +06:00
Oleg
53212c71df Migrate From Old Completions + Embedding Endpoint (#28)
* migrate away from deprecated OpenAI endpoints

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>

* test embedding correctness

Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>
2022-08-02 14:16:54 +06:00
Andy Day
d6c1c1855d Add new Embeddings endpoint (#12) 2021-12-15 11:45:22 +03:00
blfletcher
6297de371c Added a files endpoint, corrected a documents bug in answers requests, added error messages to API error handling (#6)
Co-authored-by: eyelevelai <33876565+eyelevelai@users.noreply.github.com>
2021-07-18 23:32:20 +03:00
Alexander Baranov
f5b3ec4ffe Add api client code 2020-08-19 12:57:32 +03:00