* Support Retrieve model API (#340)
* Test for GetModel error cases. (#340)
* Reduce the cognitive complexity of TestClientReturnsRequestBuilderErrors (#340)
* move error_accumulator into internal pkg (#304)
* move error_accumulator into internal pkg (#304)
* add a test for ErrTooManyEmptyStreamMessages in stream_reader (#304)
* 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
* 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
* 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
* 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
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.
* 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
* 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
* add form builder
* cover VariImage
* test for closing errors
* simplify tests
* add audio api test coverage
* don't leak authToken when printed
* rename api->client
* fix test
* add ChatCompletionStream Usage return
* ChatCompletionStreamResponse will bot return Usage
* remove the Usage field from the response, it would not be there anyway.
---------
Co-authored-by: lihang <nasa.li@deepres.com>
* 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
* 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
* Compatible with the situation where the mask is empty in CreateEditImage.
* Fix the test for the unnecessary removal of the mask.png file.
* add image variation implementation
* fix image variation bugs
* fix ci-lint problem with max line character limit
* add offitial doc link
* just for codeball test
* fix lint problem
* add optional params for audio api, e.g. prompt
* add comment for new args in translation