-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move references to ZnEntity into gtoolkit-specific package [feenkcom/…
- Loading branch information
Showing
2 changed files
with
23 additions
and
22 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/Gt4OpenAI-GToolkit/GtOpenAIUploadFileAPIClient.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Extension { #name : #GtOpenAIUploadFileAPIClient } | ||
|
||
{ #category : #'*Gt4OpenAI-GToolkit' } | ||
GtOpenAIUploadFileAPIClient >> fileToEntity [ | ||
"todo: what would be better here?" | ||
|
||
(self file isKindOf: GtLlmFineTuningFile) | ||
ifTrue: [ ^ ZnEntity with: self file contents type: 'application/jsonl' ]. | ||
^ ZnEntity bytes: self file binaryContents | ||
] | ||
|
||
{ #category : #'*Gt4OpenAI-GToolkit' } | ||
GtOpenAIUploadFileAPIClient >> request [ | ||
^ self client | ||
postFile: '/files' | ||
withEntity: (ZnMultiPartFormDataEntity new | ||
addPart: (ZnMimePart fieldName: 'purpose' value: self purpose); | ||
addPart: (ZnMimePart | ||
fieldName: 'file' | ||
fileName: self file basename | ||
entity: self fileToEntity); | ||
yourself) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters