Commit Graph

377 Commits

Author SHA1 Message Date
渡邉祐一 / Yuichi Watanabe
157de0680f add vvatanabe to FUNDING.yml (#402) 2023-06-22 13:49:46 +04:00
Alexander Baranov
ffa7abc050 Update README.md (#399) 2023-06-21 18:54:10 +04:00
渡邉祐一 / Yuichi Watanabe
e19b074a11 docs: add requires go version in README.md (#397) 2023-06-21 18:53:15 +04:00
Chris Hua
f22da8a7ed feat: allow more input types to functions, fix tests (#377)
* feat: use json.rawMessage, test functions

* chore: lint

* fix: tests

the ChatCompletion mock server doesn't actually run otherwise. N=0
is the default request but the server will treat it as n=1

* fix: tests should default to n=1 completions

* chore: add back removed interfaces, custom marshal

* chore: lint

* chore: lint

* chore: add some tests

* chore: appease lint

* clean up JSON schema + tests

* chore: lint

* feat: remove backwards compatible functions

for illustrative purposes

* fix: revert params change

* chore: use interface{}

* chore: add test

* chore: add back FunctionDefine

* chore: /s/interface{}/any

* chore: add back jsonschemadefinition

* chore: testcov

* chore: lint

* chore: remove pointers

* chore: update comment

* chore: address CR

added test for compatibility as well

---------

Co-authored-by: James <jmacwhyte@MacBooger-II.local>
2023-06-21 16:58:27 +04:00
Liu Shuang
e948150829 fix: chat stream returns an error response with a 'data: ' prefix (#396)
* fix: chat stream resp has 'data: ' prefix

* fix: lint error

* fix: lint error

* fix: lint error
2023-06-20 19:39:19 +04:00
cem-unuvar
720377087f feat: added function call info to chat completions (#390) 2023-06-20 19:33:53 +04:00
渡邉祐一 / Yuichi Watanabe
68f9ef92be split integration test using go build tag (#392) 2023-06-19 12:12:38 +04:00
渡邉祐一 / Yuichi Watanabe
b0959382c8 extract and split integration tests (#389) 2023-06-18 14:51:20 +04:00
渡邉祐一 / 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
romazu
f0770cfe1d audio: add items to AudioResponseFormat enum (#382)
* audio: add items to AudioResponseFormat enum

* audio: expand AudioResponse struct to accommodate verbose json response

---------

Co-authored-by: Roman Zubov <rzubov@aintsys.com>
2023-06-16 17:13:26 +04:00
Alex Wormuth
ac25f318ba add items, which is required for array type (#373)
* add items, which is required for array type

* use JSONSchemaDefine directly
2023-06-16 17:11:50 +04:00
Liu Shuang
0bd14f9584 refactor: ChatCompletionStreamChoice.FinishReason from string to FinishReason (#372) 2023-06-15 13:58:26 +04:00
Alexander Baranov
43de77162f Create FUNDING.yml (#371) 2023-06-15 12:53:52 +04:00
Ccheers
2bd65aa720 feat(chat): support function call api (#369)
* feat(chat): support function call api

* rename struct & add const ChatMessageRoleFunction
2023-06-15 12:49:54 +04:00
beichideyuwan
7e76a682a9 Add 16k 0613 model (#365)
* add 16k_0613 model

* add 16k_0613 model

* add model:
2023-06-14 18:23:03 +04:00
Rich Coggins
646989cc5b Improve (#356) to support registration of wildcard URLs (#359)
* Improve (#356) to support registration of wildcard URLs

* Add TestAzureChatCompletions & TestAzureChatCompletionsWithCustomDeploymentName

* Remove TestAzureChatCompletionsWithCustomDeploymentName

---------

Co-authored-by: coggsflod <richard.coggins@officedepot.com>
2023-06-14 18:19:18 +04:00
Simon Klee
3f4e3bb0ca models: add *-0613 models (#361)
Added GPT3Dot5Turbo0613, GPT3Dot5Turbo16K, GPT40613, and GPT432K0613
models from June update
(https://openai.com/blog/function-calling-and-other-api-updates)

Issue #360
2023-06-14 00:32:26 +04:00
渡邉祐一 / Yuichi Watanabe
b616090e69 refactoring tests with mock servers (#30) (#356) 2023-06-12 17:40:26 +04:00
渡邉祐一 / Yuichi Watanabe
a243e7331f Support Retrieve file content API (#347) (#348)
* Support Retrieve file content API (#347)

* add timeout test for GetFileContent (#347)
2023-06-11 12:49:57 +04:00
渡邉祐一 / Yuichi Watanabe
06b16a7281 fix json marshaling error response of azure openai (#343) (#345)
* fix json marshaling error response of azure openai (#343)

* add a test case for handleErrorResp func (#343)
2023-06-08 19:32:03 +04:00
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
6830e00406 Support Retrieve model API (#340) (#341)
* Support Retrieve model API (#340)

* Test for GetModel error cases. (#340)

* Reduce the cognitive complexity of TestClientReturnsRequestBuilderErrors (#340)
2023-06-05 18:37:08 +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
Mariano Darc
fa694c61c2 Implement optional io.Reader in AudioRequest (#303) (#265) (#331)
* Implement optional io.Reader in AudioRequest (#303) (#265)

* Fix err shadowing

* Add test to cover AudioRequest io.Reader usage

* Add additional test cases to cover AudioRequest io.Reader usage

* Add test to cover opening the file specified in an AudioRequest
2023-06-05 10:07:13 +04:00
渡邉祐一 / Yuichi Watanabe
61ba5f3369 move request_builder into internal pkg (#304) (#329)
* move request_builder into internal pkg (#304)

* add some test for internal.RequestBuilder

* add a test for openai.GetEngine
2023-05-31 12:01:42 +04:00
渡邉祐一 / Yuichi Watanabe
62eb4beed2 move marshaller and unmarshaler into internal pkg (#304) (#325) 2023-05-28 05:51:07 +04:00
Bo-Yi Wu
980504b47e docs(readme): update format (#317) 2023-05-27 14:13:41 +04:00
Rich Coggins
a18c18d5e8 Update README.md with Azure OpenAI Embeddings example (#318) 2023-05-22 08:18:31 +04:00
Tom Hennessy
faae8b4b4b Update README.md (#319)
Added in `unofficial` to the README to make it clear it's not official.
2023-05-22 08:17:16 +04:00
Takahiro Ikeuchi
b62a325b0a Azure OpenAI API version 2023-05-15 (#316)
* chore(config.go): update Azure API version to 2023-05-15 to use the latest version available

* chore(api_internal_test.go): update Azure API version to 2023-05-15 to match the latest version
2023-05-19 12:04:16 -07:00
JoyShi
21eef5bc8d Move form_builder into internal pkg. (#311)
* Move form_uilder into internal pkg.

* Fix import of audio.go

* Reorganize.

* Fix import.

* Fix

---------

Co-authored-by: JoyShi <joy.shi@sap.com>
2023-05-16 13:38:09 -07:00
xuanming.zhang
83d03fca52 Adjust the azure model deployment name call corresponding to README (#309) 2023-05-14 21:29:28 -07:00
GargantuaX
be253c2d63 change azure engine config to modelMapper (#306)
* change azure engine config to azure modelMapper config

* Update go.mod

* Revert "Update go.mod"

This reverts commit 78d14c58f2a9ce668da43f6adbe20b60afcfe0d7.

* lint fix

* add test

* lint fix

* lint fix

* lint fix

* opt

* opt

* opt

* opt
2023-05-11 01:30:24 +04:00
Hoani Bryson
5f4ff3ebfa Add Readme example to example_test.go (#298)
* Add speech to text example in docs

* Add caption formats for audio transcription

* Add caption example to README

* Address sanity check errors

* Add tests for decodeResponse

* Use typechecker for audio response format

* Decoding response refactors

* Migrated examples to example_test.go

* Add some executable examples

* Update error docs

* Avoid linting example files which break conventions

* Restore README examples

* Enable linting for example_test
2023-05-08 20:16:01 +04:00
Semenchenko Kirill
39abb5a4be add missing error processing for audio (#301)
Co-authored-by: Kirill Semenchenko <smoreg@mc2soft.ru>
2023-05-04 22:30:14 +04:00
Quest Henkart
a24581dce2 maintain underlying error structs to allow for type conversion (#293)
* maintain underlying error structs to allow for type conversion and
defensive error checking

* allow Error.Is for Azure responses

* update readme, add tests to ensure type conversion

* fix whitespacing

* read me

* add import to readme example
2023-05-03 22:48:59 +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
Juan
104c0c0b63 Azure openai list models (#290)
* feat(models): include flow for azure openai endpoint

* feat(models): include flow for azure openai endpoint

* feat(models): include flow for azure openai endpoint

* chore(fullURL): update logic to run in fullURL function

* chore(fullURL): update based on pr comments to use c.config.APIVersion
2023-05-03 13:02:35 +04:00
quzard
1b8feae0b6 Do not return when not present (#294) 2023-05-02 21:41:21 +04:00
sashabaranov
af9ff51077 fix expected error message (#289) 2023-05-01 02:41:40 +04:00
xuanming.zhang
67aef196d2 Fix OpenAI or Azure returns an undefined error message return (#283)
* Fix OpenAI or Azure returns an undefined error message return

* Fix: OpenAI or Azure returns an undefined error message return
#280

* Fix: OpenAI or Azure returns an undefined error message return
#280

* Fix: OpenAI or Azure returns an undefined error message return
#280

Handle long line

* Fix: OpenAI or Azure returns an undefined error message return
#280

Add unit test ErrorResponse nil pointer check

* Fix: OpenAI or Azure returns an undefined error message return
#280

Add unit test ErrorResponse nil pointer check

---------

Co-authored-by: zhangxm <xuanming_zhang@qingsongchou.com>
2023-05-01 01:21:15 +04:00
Liu Shuang
cacd976a0c feat: RequestError print status code (#285) 2023-05-01 01:18:43 +04:00
刘丹冰
2f008f7054 fix:model param type, add moderation Model Name const. (#270)
* add ImageEditRequest.ResponseFormat

* add ImageEditRequest/ImageVariRequest.ResponseFormat

* complete image_test

* delete var prompt param

* fix:model param type, add  moderation Model Name const.

* rename ModerationText001

---------

Co-authored-by: Aceld <liudanbing@tal.com>
2023-04-20 14:10:19 +01:00
biubiu7
c2b58e77ed Fixing missing OrgId assignment issue in the ChatCompletionStream (#268)
* Update client.go

* Add test

---------

Co-authored-by: panjiajia <panjiajia@haoshuo.com>
2023-04-20 14:08:29 +01:00
Hoani Bryson
ecdea45b67 Adds support for audio captioning with Whisper (#267)
* Add speech to text example in docs

* Add caption formats for audio transcription

* Add caption example to README

* Address sanity check errors

* Add tests for decodeResponse

* Use typechecker for audio response format

* Decoding response refactors
2023-04-20 14:07:04 +01:00
Liu Shuang
d6ab1b3a4f fix: chat stream resp error (#259) 2023-04-19 13:05:00 +01:00
刘丹冰
3b10c032b6 add ImageVariRequest/ImageEditRequest.ResponseFormat (#264)
* add ImageEditRequest.ResponseFormat

* add ImageEditRequest/ImageVariRequest.ResponseFormat

* complete image_test

* delete var prompt param

---------

Co-authored-by: Aceld <liudanbing@tal.com>
2023-04-18 11:23:29 +02:00
Stephen Young
061c97ef7e Implement Unmarshaller interface. Resolves #244 (#248) 2023-04-14 20:09:40 +02:00
sashabaranov
d94c5e7edd Test request builder + streams (#242)
* test request builder + streams

* provide prompt to test
2023-04-09 18:46:58 +04:00
sashabaranov
9a1ecf5f4a Add more tests (#241)
* add form builder tests

* lint

* add client tests

* lint

* add non-existent file test
2023-04-09 18:36:15 +04:00