[ Edit ] editing the test file

This commit is contained in:
Anas Fikhi
2024-02-22 00:54:20 +01:00
parent 087b62b897
commit e3973a7439
4 changed files with 26 additions and 10 deletions

View File

@ -1,5 +1,15 @@
# Changelog
## 5.1.0
- Massive issues fixes related to incorrecr use of types, model fields..., audio transcription file streaming error handling, and more.
- Support for newer fields & options for the chat completions API, like `name` for messages.
- Support for audio transcription granularity.
- General improvements, and more tests.
## 5.0.0
- Bug fix in the `RequestFunctionMessage`'s `toMap()` method.
@ -15,7 +25,7 @@
## 4.1.3
- Added Audio Speech method in the Audio module with its docs, example code.
- Migrated for the deprecated _`functions`_and `function_call` th the use of new fields such `tools`.. in the chat API, confirmed that it works on both asynchronous and stream responses.
- Migrated for the deprecated \_`functions`\_and `function_call` th the use of new fields such `tools`.. in the chat API, confirmed that it works on both asynchronous and stream responses.
- Exposed API for controlling the requests time out for all internal client methods.
- Exposed multi content calls for chat completion API for image and text..
@ -45,7 +55,7 @@
## 3.0.0
- Added support for functions feature of the chat API.
- Bugs fixes.
- Bugs fixes.
## 2.0.1

View File

@ -258,7 +258,7 @@ abstract class OpenAINetworkingClient {
final fileTypeHeader = "content-type";
final fileExtensionFromBodyResponseFormat =
response.headers[fileTypeHeader]?.split("/")?.last ?? "mp3";
response.headers[fileTypeHeader]?.split("/").last ?? "mp3";
final fileName =
outputFileName + "." + fileExtensionFromBodyResponseFormat;
@ -399,17 +399,23 @@ abstract class OpenAINetworkingClient {
final statusCode = respond.statusCode;
final exception = RequestFailedException(message, statusCode);
yield* Stream<T>.error(error); // Error cases sent from openai
yield* Stream<T>.error(
exception,
); // Error cases sent from openai
}
}
} // end of await for
} catch (error, stackTrace) {
yield* Stream<T>.error(
error, stackTrace); // Error cases in handling stream
error,
stackTrace,
); // Error cases in handling stream
}
} catch (error, stackTrace) {
yield* Stream<T>.error(error,
stackTrace); // Error cases in decoding stream from response
yield* Stream<T>.error(
error,
stackTrace,
); // Error cases in decoding stream from response
}
} catch (e) {
yield* Stream<T>.error(e); // Error cases in getting response

View File

@ -1,6 +1,6 @@
name: dart_openai
description: Dart SDK for openAI Apis (GPT-3 & DALL-E), integrate easily the power of OpenAI's state-of-the-art AI models into their Dart applications.
version: 5.0.1
version: 5.1.0
homepage: https://github.com/anasfik/openai
repository: https://github.com/anasfik/openai
documentation: https://github.com/anasfik/openai/blob/main/README.md
@ -10,7 +10,7 @@ environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
http:
http: ^1.1.0
meta: ^1.9.1
collection: ^1.17.2
fetch_client: ^1.0.2

View File

@ -38,7 +38,7 @@ void main() async {
}
});
test('with setting a key', () {
OpenAI.apiKey = "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";
OpenAI.apiKey = "YOUR API KEY HERE";
expect(OpenAI.instance, isA<OpenAI>());
});