Skip to content

Commit

Permalink
refactor: Upgrade api clients generator version
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmigloz committed Dec 6, 2024
1 parent 2133296 commit fd2db20
Show file tree
Hide file tree
Showing 65 changed files with 2,290 additions and 934 deletions.
6 changes: 3 additions & 3 deletions examples/browser_summarizer/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ packages:
path: "../../packages/langchain_community"
relative: true
source: path
version: "0.3.2+1"
version: "0.3.2+2"
langchain_core:
dependency: "direct overridden"
description:
Expand All @@ -254,7 +254,7 @@ packages:
path: "../../packages/langchain_openai"
relative: true
source: path
version: "0.7.2+3"
version: "0.7.2+5"
langchain_tiktoken:
dependency: transitive
description:
Expand Down Expand Up @@ -325,7 +325,7 @@ packages:
path: "../../packages/openai_dart"
relative: true
source: path
version: "0.4.2+2"
version: "0.4.4"
path:
dependency: transitive
description:
Expand Down
10 changes: 5 additions & 5 deletions examples/docs_examples/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
path: "../../packages/anthropic_sdk_dart"
relative: true
source: path
version: "0.1.0"
version: "0.2.0"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -244,7 +244,7 @@ packages:
path: "../../packages/langchain_anthropic"
relative: true
source: path
version: "0.1.1+2"
version: "0.2.0"
langchain_chroma:
dependency: "direct main"
description:
Expand All @@ -258,7 +258,7 @@ packages:
path: "../../packages/langchain_community"
relative: true
source: path
version: "0.3.2+1"
version: "0.3.2+2"
langchain_core:
dependency: "direct overridden"
description:
Expand Down Expand Up @@ -293,7 +293,7 @@ packages:
path: "../../packages/langchain_openai"
relative: true
source: path
version: "0.7.2+3"
version: "0.7.2+5"
langchain_tiktoken:
dependency: transitive
description:
Expand Down Expand Up @@ -354,7 +354,7 @@ packages:
path: "../../packages/openai_dart"
relative: true
source: path
version: "0.4.2+2"
version: "0.4.4"
path:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions examples/hello_world_backend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ packages:
path: "../../packages/langchain_openai"
relative: true
source: path
version: "0.7.2+3"
version: "0.7.2+5"
langchain_tiktoken:
dependency: transitive
description:
Expand All @@ -148,7 +148,7 @@ packages:
path: "../../packages/openai_dart"
relative: true
source: path
version: "0.4.2+2"
version: "0.4.4"
path:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions examples/hello_world_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ packages:
path: "../../packages/langchain_openai"
relative: true
source: path
version: "0.7.2+3"
version: "0.7.2+5"
langchain_tiktoken:
dependency: transitive
description:
Expand All @@ -140,7 +140,7 @@ packages:
path: "../../packages/openai_dart"
relative: true
source: path
version: "0.4.2+2"
version: "0.4.4"
path:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions examples/hello_world_flutter/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ packages:
path: "../../packages/langchain_openai"
relative: true
source: path
version: "0.7.2+3"
version: "0.7.2+5"
langchain_tiktoken:
dependency: transitive
description:
Expand Down Expand Up @@ -292,7 +292,7 @@ packages:
path: "../../packages/openai_dart"
relative: true
source: path
version: "0.4.2+2"
version: "0.4.4"
path:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/wikivoyage_eu/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ packages:
path: "../../packages/langchain_community"
relative: true
source: path
version: "0.3.2+1"
version: "0.3.2+2"
langchain_core:
dependency: "direct overridden"
description:
Expand Down
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ command:
openapi_spec:
git:
url: https://github.com/davidmigloz/openapi_spec.git
ref: 93230a5e346b02789f0f727da8eecea9c7bdf118
ref: c99a29b7eaad2d25e7ceb90be56e6a9a41066322
test: ^1.25.8

scripts:
Expand Down
2 changes: 1 addition & 1 deletion packages/anthropic_sdk_dart/lib/src/generated/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AnthropicClient {
final http.Client client;

/// Authentication related variables
final String apiKey;
String apiKey;

// ------------------------------------------
// METHOD: endSession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ sealed class Block with _$Block {
// ------------------------------------------

/// A block of text content.
@FreezedUnionValue('text')
const factory Block.text({
/// The text content.
required String text,
Expand All @@ -35,6 +37,8 @@ sealed class Block with _$Block {
// ------------------------------------------

/// A block of image content.
@FreezedUnionValue('image')
const factory Block.image({
/// The source of an image block.
required ImageBlockSource source,
Expand All @@ -52,6 +56,8 @@ sealed class Block with _$Block {
// ------------------------------------------

/// The tool the model wants to use.
@FreezedUnionValue('tool_use')
const factory Block.toolUse({
/// A unique identifier for this particular tool use block.
/// This will be used to match up the tool results later.
Expand All @@ -76,6 +82,8 @@ sealed class Block with _$Block {
// ------------------------------------------

/// The result of using a tool.
@FreezedUnionValue('tool_result')
const factory Block.toolResult({
/// The `id` of the tool use request this is a result for.
@JsonKey(name: 'tool_use_id') required String toolUseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ sealed class BlockDelta with _$BlockDelta {
// ------------------------------------------

/// A delta in a streaming text block.
@FreezedUnionValue('text_delta')
const factory BlockDelta.textDelta({
/// The text delta.
required String text,
Expand All @@ -31,6 +33,8 @@ sealed class BlockDelta with _$BlockDelta {
// ------------------------------------------

/// A delta in a streaming input JSON.
@FreezedUnionValue('input_json_delta')
const factory BlockDelta.inputJsonDelta({
/// The partial JSON delta.
@JsonKey(name: 'partial_json', includeIfNull: false) String? partialJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ enum Models {
claude21,
@JsonValue('claude-2.0')
claude20,
@JsonValue('claude-instant-1.2')
claudeInstant12,
}

// ==========================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A start event in a streaming conversation.
const factory MessageStreamEvent.messageStart({
/// A message in a chat conversation.
required Message message,
Expand All @@ -31,6 +32,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A delta event in a streaming conversation.
const factory MessageStreamEvent.messageDelta({
/// A delta in a streaming message.
required MessageDelta delta,
Expand Down Expand Up @@ -58,6 +60,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A stop event in a streaming conversation.
const factory MessageStreamEvent.messageStop({
/// The type of a streaming event.
required MessageStreamEventType type,
Expand All @@ -68,6 +71,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A start event in a streaming content block.
const factory MessageStreamEvent.contentBlockStart({
/// A block of content in a message.
/// Any of: [TextBlock], [ImageBlock], [ToolUseBlock], [ToolResultBlock]
Expand All @@ -85,6 +89,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A delta event in a streaming content block.
const factory MessageStreamEvent.contentBlockDelta({
/// A delta in a streaming message.
/// Any of: [TextBlockDelta], [InputJsonBlockDelta]
Expand All @@ -102,6 +107,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A stop event in a streaming content block.
const factory MessageStreamEvent.contentBlockStop({
/// The index of the content block.
required int index,
Expand All @@ -115,6 +121,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// A ping event in a streaming conversation.
const factory MessageStreamEvent.ping({
/// The type of a streaming event.
required MessageStreamEventType type,
Expand All @@ -125,6 +132,7 @@ sealed class MessageStreamEvent with _$MessageStreamEvent {
// ------------------------------------------

/// An error event in a streaming conversation.
const factory MessageStreamEvent.error({
/// The type of a streaming event.
required MessageStreamEventType type,
Expand Down
15 changes: 15 additions & 0 deletions packages/anthropic_sdk_dart/lib/src/generated/schema/schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
library anthropic_schema;

import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:typed_data';

part 'schema.g.dart';
part 'schema.freezed.dart';
Expand All @@ -32,3 +33,17 @@ part 'tool.dart';
part 'block.dart';
part 'message_stream_event.dart';
part 'block_delta.dart';

class Uint8ListConverter implements JsonConverter<Uint8List, List<int>> {
const Uint8ListConverter();

@override
Uint8List fromJson(List<int> json) {
return Uint8List.fromList(json);
}

@override
List<int> toJson(Uint8List object) {
return object.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5807,11 +5807,11 @@ Tool _$ToolFromJson(Map<String, dynamic> json) {
switch (json['type']) {
case 'custom':
return ToolCustom.fromJson(json);
case 'computer_use':
case 'computer_20241022':
return ToolComputerUse.fromJson(json);
case 'text_editor':
case 'text_editor_20241022':
return ToolTextEditor.fromJson(json);
case 'bash':
case 'bash_20241022':
return ToolBash.fromJson(json);

default:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sealed class Tool with _$Tool {
// ------------------------------------------

/// A custom tool the model may use.
const factory Tool.custom({
/// The type of tool.
@JsonKey(includeIfNull: false) String? type,
Expand Down Expand Up @@ -45,6 +46,8 @@ sealed class Tool with _$Tool {
// ------------------------------------------

/// A tool that uses a mouse and keyboard to interact with a computer, and take screenshots.
@FreezedUnionValue('computer_20241022')
const factory Tool.computerUse({
/// The type of tool.
@Default('computer_20241022') String type,
Expand All @@ -71,6 +74,8 @@ sealed class Tool with _$Tool {
// ------------------------------------------

/// A tool for viewing, creating and editing files.
@FreezedUnionValue('text_editor_20241022')
const factory Tool.textEditor({
/// The type of tool.
@Default('text_editor_20241022') String type,
Expand All @@ -88,6 +93,8 @@ sealed class Tool with _$Tool {
// ------------------------------------------

/// A tool for running commands in a bash shell.
@FreezedUnionValue('bash_20241022')
const factory Tool.bash({
/// The type of tool.
@Default('bash_20241022') String type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ components:
- claude-3-haiku-20240307
- claude-2.1
- claude-2.0
- claude-instant-1.2
messages:
type: array
description: |
Expand Down
4 changes: 2 additions & 2 deletions packages/anthropic_sdk_dart/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ packages:
dependency: "direct dev"
description:
path: "."
ref: "93230a5e346b02789f0f727da8eecea9c7bdf118"
resolved-ref: "93230a5e346b02789f0f727da8eecea9c7bdf118"
ref: c99a29b7eaad2d25e7ceb90be56e6a9a41066322
resolved-ref: c99a29b7eaad2d25e7ceb90be56e6a9a41066322
url: "https://github.com/davidmigloz/openapi_spec.git"
source: git
version: "0.7.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/anthropic_sdk_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ dev_dependencies:
openapi_spec:
git:
url: https://github.com/davidmigloz/openapi_spec.git
ref: 93230a5e346b02789f0f727da8eecea9c7bdf118
ref: c99a29b7eaad2d25e7ceb90be56e6a9a41066322
test: ^1.25.8
Loading

0 comments on commit fd2db20

Please sign in to comment.