Skip to content

Commit

Permalink
[ Edit ] editing the test file
Browse files Browse the repository at this point in the history
  • Loading branch information
anasfik committed Feb 21, 2024
1 parent 087b62b commit e3973a7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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..

Expand Down Expand Up @@ -45,7 +55,7 @@
## 3.0.0

- Added support for functions feature of the chat API.
- Bugs fixes.
- Bugs fixes.

## 2.0.1

Expand Down
16 changes: 11 additions & 5 deletions lib/src/core/networking/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/openai_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>());
});
Expand Down

0 comments on commit e3973a7

Please sign in to comment.