Skip to content

Commit

Permalink
Move references to ZnEntity into gtoolkit-specific package [feenkcom/…
Browse files Browse the repository at this point in the history
  • Loading branch information
hellerve committed Mar 3, 2025
1 parent c6361a5 commit 2132e96
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
23 changes: 23 additions & 0 deletions src/Gt4OpenAI-GToolkit/GtOpenAIUploadFileAPIClient.extension.st
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)
]
22 changes: 0 additions & 22 deletions src/Gt4OpenAI/GtOpenAIUploadFileAPIClient.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ GtOpenAIUploadFileAPIClient >> file: anObject [
file := anObject
]

{ #category : #accessing }
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 : #accessing }
GtOpenAIUploadFileAPIClient >> purpose [
^ purpose
Expand All @@ -37,19 +28,6 @@ GtOpenAIUploadFileAPIClient >> purpose: anObject [
purpose := anObject
]

{ #category : #accessing }
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)
]

{ #category : #accessing }
GtOpenAIUploadFileAPIClient >> serializationClass [
^ GtOpenAIFile
Expand Down

0 comments on commit 2132e96

Please sign in to comment.