Commit Graph

246 Commits

Author SHA1 Message Date
Mehul Gohil
0234c1e0c2 add example: fine tune (#438)
* add example for fine tune

* update example for fine tune

* fix comments
2023-07-15 07:13:05 +09:00
Munar
e22a29d84e Check if the model param is valid for moderations endpoint (#437)
* chore: check for models before sending moderation requets to openai endpoint

* chore: table driven tests to include more model cases for moderations endpoint
2023-07-13 13:30:58 +09:00
渡邉祐一 / Yuichi Watanabe
39b2acb5c9 ci: set up closing-inactive-issues in GitHub Action (129) (#428) 2023-07-12 17:15:39 +03:00
渡邉祐一 / Yuichi Watanabe
c3b2451f7c fix: invalid schema for function 'func_name': None is not of type 'object' (#429)(#432) (#434)
* fix: invalid schema for function 'func_name': None is not of type 'object' (#429)(#432)

* test: add integration test for function call (#429)(#432)

* style: remove duplicate import (#429)(#432)
2023-07-11 14:48:15 +03:00
渡邉祐一 / Yuichi Watanabe
f028c289d2 fix: function call error due to nil properties (429) (#431)
* fix: fix function call error due to nil properties (429)

* refactor: refactoring initializeProperties func in jsonschema pkg (429)
2023-07-09 20:07:01 +03:00
渡邉祐一 / Yuichi Watanabe
181fc2ade9 docs: explanation about LogitBias. (129) (#426) 2023-07-09 12:11:39 +03:00
Liu Shuang
7b22898f5d Implement OpenAI July 2023 Updates (#427)
* Implement OpenAI July 2023 Updates

* fix: golangci-lint

* add comment

* fix: remove some model Deprecated
2023-07-09 12:09:50 +03:00
渡邉祐一 / Yuichi Watanabe
619ad71735 docs: added instructions for obtaining OpenAI API key to README (#421)
* docs: added instructions for obtaining OpenAI API key to README

* docs: move 'Getting an OpenAI API key' before 'Other examples'
2023-07-06 00:54:27 +03:00
Jackson Stone
5c7d88212f Allow embeddings requests to be tokens or strings (#417)
* Allow raw tokens to be used as embedding input

* fix linting issues (lines too long)

* add endpoint test for embedding from tokens

* remove redundant comments

* fix comment to match new param name

* change interface to any

* Rename methods and implement convert for base req

* add comments to CreateEmbeddings

* update tests

* shorten line length

* rename parameter
2023-07-06 00:53:53 +03:00
渡邉祐一 / Yuichi Watanabe
204260818e docs: remove medatada in PULL_REQUEST_TEMPLATE.md (#423) 2023-07-03 13:46:38 +03:00
Rick
177c143be7 Fix OpenAI error when properties is empty in function call : object schema missing properties (#419)
Co-authored-by: Rick <medivhzhan@icloud.com>
2023-07-01 07:38:22 +09:00
渡邉祐一 / Yuichi Watanabe
1efcf2d23d fix: move pull request template (#420) 2023-06-30 14:49:36 +04:00
ryomak
9c99f3626f replace deprecated FunctionDefine in chat_test.go (#416) 2023-06-29 09:41:22 +09:00
渡邉祐一 / Yuichi Watanabe
86d0f48d2d chore: add a pull request template (#412) 2023-06-28 21:18:34 +04:00
渡邉祐一 / Yuichi Watanabe
581f70b102 chore: add an issue template for bug report (#408) 2023-06-26 18:33:32 +04:00
渡邉祐一 / Yuichi Watanabe
a3c0b36b35 chore: add an issue template for feature request (#410) 2023-06-26 18:32:57 +04:00
James MacWhyte
0ca4ea4867 move json schema to directory/package (#407)
* move json schema to directory/package

* added jsonschema to README
2023-06-24 20:22:11 +04:00
Alexander Baranov
5f4ef298e3 Update README.md (#406) 2023-06-23 13:07:43 +04:00
渡邉祐一 / Yuichi Watanabe
f1b66967a4 refactor: refactoring http request creation and sending (#395)
* refactoring http request creation and sending

* fix lint error

* increase the test coverage of client.go

* refactor: Change the style of HTTPRequestBuilder.Build func to one-argument-per-line.
2023-06-22 13:57:52 +04:00
渡邉祐一 / 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