Skip to content

Commit bb305b0

Browse files
ThorbJThorb JiangiBotPeaches
authored
fix: Add compatibility for Aliyun compatibility layer for Files (#530)
* Add compatibility for aliyun LLM APIs * test: add test to confirm status_details missing --------- Co-authored-by: Thorb Jiang <[email protected]> Co-authored-by: Connor Tumbleson <[email protected]>
1 parent a1fe444 commit bb305b0

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

src/Responses/Files/CreateResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function from(array $attributes, MetaInformation $meta): self
5454
$attributes['filename'],
5555
$attributes['purpose'],
5656
$attributes['status'],
57-
$attributes['status_details'],
57+
$attributes['status_details'] ?? null,
5858
$meta,
5959
);
6060
}

src/Responses/Files/RetrieveResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function from(array $attributes, MetaInformation $meta): self
5454
$attributes['filename'],
5555
$attributes['purpose'],
5656
$attributes['status'],
57-
$attributes['status_details'],
57+
$attributes['status_details'] ?? null,
5858
$meta,
5959
);
6060
}

src/Responses/FineTunes/RetrieveResponseFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function from(array $attributes): self
4646
$attributes['filename'],
4747
$attributes['purpose'],
4848
$attributes['status'],
49-
$attributes['status_details'],
49+
$attributes['status_details'] ?? null,
5050
);
5151
}
5252

tests/Responses/Files/RetrieveResponse.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@
5050
->meta()->toBeInstanceOf(MetaInformation::class);
5151
});
5252

53+
test('from with status_details missing', function () {
54+
$data = fileResource();
55+
unset($data['status_details']);
56+
57+
$result = RetrieveResponse::from($data, meta());
58+
59+
expect($result)
60+
->toBeInstanceOf(RetrieveResponse::class)
61+
->statusDetails->toBeNull();
62+
});
63+
5364
test('as array accessible', function () {
5465
$result = RetrieveResponse::from(fileResource(), meta());
5566

0 commit comments

Comments
 (0)