Commit Graph

15 Commits

Author SHA1 Message Date
ttys3
8677fb4bb4 feat: add azure openai support (#214)
* feat: add azure openai support

* chore: refine config

* chore: make config options like the python one

* chore: adjust config struct field order

* test: fix tests

* style: make the linter happy

* fix: support Azure API Key authentication in sendRequest

* chore: check error in CreateChatCompletionStream

* chore: pass tests

* chore: try pass tests again

* chore: change ClientConfig back due to this lib does not like WithXxx config style

* chore: revert fix to CreateChatCompletionStream() due to cause tests not pass

* chore: at least add some comment about the required fields

* chore: re order ClientConfig fields

* chore: add DefaultAzure()

* chore: set default api_version the same as py one "2023-03-15-preview"

* style: fixup typo

* test: add api_internal_test.go

* style: make lint happy

* chore: add constant AzureAPIKeyHeader

* chore: use AzureAPIKeyHeader for api-key header, fix azure base url auto trim suffix /

* test: add TestAzureFullURL, TestRequestAuthHeader and TestOpenAIFullURL

* test: simplify TestRequestAuthHeader

* test: refine TestOpenAIFullURL

* chore: refine comments

* feat: DefaultAzureConfig
2023-04-04 12:05:20 +04:00
sashabaranov
c34bc77f1a Add testable request builder (#162)
* Add testable request builder

* improve tests
2023-03-15 13:16:33 +04:00
sashabaranov
53d195cf5a add testable json marshaller (#161) 2023-03-15 12:16:47 +04:00
Alexander Baranov
9eea94730a rename internally 2023-03-04 15:29:42 +04:00
bestgopher
575c4e4adb remove pointer (#113) 2023-03-03 15:59:30 +04:00
Afeyer
39ca4e9488 Implement chat completion streaming (#101)
* Implement chat completion streaming

* Optimize the implementation of chat completion stream

* Fix linter error
2023-03-03 09:52:02 +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
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
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
blfletcher
7c56bd3034 Added delete endpoint (#8)
* Added a files endpoint, corrected a documents bug in answers requests, added error messages to API error handling

* Added file upload endpoint

* Added DeleteFile endpoint

Co-authored-by: eyelevelai <33876565+eyelevelai@users.noreply.github.com>
2021-08-05 10:59:34 +03:00
blfletcher
3dfb5bd804 File upload endpoint (#7) 2021-08-03 18:51:23 +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
Tor Hagemann
8b3c0d0c52 api.go: add constructor variant for organizations 2021-06-03 14:24:15 -07:00
Alexander Baranov
f5b3ec4ffe Add api client code 2020-08-19 12:57:32 +03:00