Skip to content

Commit 85eea9c

Browse files
committed
Update architecture to have correctly outline revised file API layer.
1 parent b409875 commit 85eea9c

File tree

1 file changed

+40
-55
lines changed

1 file changed

+40
-55
lines changed

docs/ARCHITECTURE.md

Lines changed: 40 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ direction LR
304304
class PromptBuilder {
305305
+withText(string $text) self
306306
+withInlineImage(string $base64Blob, string $mimeType)
307-
+withLocalImage(string $path, string $mimeType)
308307
+withRemoteImage(string $uri, string $mimeType)
309308
+withImageFile(File $file) self
310309
+withAudioFile(File $file) self
@@ -340,12 +339,12 @@ direction LR
340339
+generateText() string
341340
+generateTexts(?int $candidateCount) string[]
342341
+streamGenerateText() Generator< string >
343-
+generateImage() FileInterface
344-
+generateImages(?int $candidateCount) FileInterface[]
345-
+convertTextToSpeech() FileInterface
346-
+convertTextToSpeeches(?int $candidateCount) FileInterface[]
347-
+generateSpeech() FileInterface
348-
+generateSpeeches(?int $candidateCount) FileInterface[]
342+
+generateImage() File
343+
+generateImages(?int $candidateCount) File[]
344+
+convertTextToSpeech() File
345+
+convertTextToSpeeches(?int $candidateCount) File[]
346+
+generateSpeech() File
347+
+generateSpeeches(?int $candidateCount) File[]
349348
+generateEmbeddings() Embedding[]
350349
+getModelRequirements() ModelRequirements
351350
+isSupported() bool
@@ -468,7 +467,6 @@ direction LR
468467
class PromptBuilder {
469468
+withText(string $text) self
470469
+withInlineImage(string $base64Blob, string $mimeType)
471-
+withLocalImage(string $path, string $mimeType)
472470
+withRemoteImage(string $uri, string $mimeType)
473471
+withImageFile(File $file) self
474472
+withAudioFile(File $file) self
@@ -504,12 +502,12 @@ direction LR
504502
+generateText() string
505503
+generateTexts(?int $candidateCount) string[]
506504
+streamGenerateText() Generator< string >
507-
+generateImage() FileInterface
508-
+generateImages(?int $candidateCount) FileInterface[]
509-
+convertTextToSpeech() FileInterface
510-
+convertTextToSpeeches(?int $candidateCount) FileInterface[]
511-
+generateSpeech() FileInterface
512-
+generateSpeeches(?int $candidateCount) FileInterface[]
505+
+generateImage() File
506+
+generateImages(?int $candidateCount) File[]
507+
+convertTextToSpeech() File
508+
+convertTextToSpeeches(?int $candidateCount) File[]
509+
+generateSpeech() File
510+
+generateSpeeches(?int $candidateCount) File[]
513511
+generateEmbeddings() Embedding[]
514512
+getModelRequirements() ModelRequirements
515513
+isSupported() bool
@@ -535,26 +533,20 @@ direction LR
535533
}
536534
}
537535
538-
namespace AiClientNamespace.Files.Contracts {
539-
class FileInterface {
540-
}
541-
}
542-
543536
namespace AiClientNamespace.Files.DTO {
544-
class InlineFile {
545-
+getMimeType() string
546-
+getBase64Data() string
547-
+getJsonSchema() array< string, mixed >$
548-
}
549-
class LocalFile {
537+
class File {
538+
+getFileType() FileTypeEnum
550539
+getMimeType() string
551-
+getPath() string
540+
+getUrl() ?string
541+
+getBase64Data() ?string
552542
+getJsonSchema() array< string, mixed >$
553543
}
554-
class RemoteFile {
555-
+getMimeType() string
556-
+getUrl() string
557-
+getJsonSchema() array< string, mixed >$
544+
}
545+
546+
namespace AiClientNamespace.Files.Enums {
547+
class FileTypeEnum {
548+
INLINE
549+
REMOTE
558550
}
559551
}
560552
@@ -567,8 +559,7 @@ direction LR
567559
class MessagePart {
568560
+getType() MessagePartTypeEnum
569561
+getText() string?
570-
+getInlineFile() InlineFile?
571-
+getRemoteFile() RemoteFile?
562+
+getFile() File?
572563
+getFunctionCall() FunctionCall?
573564
+getFunctionResponse() FunctionResponse?
574565
+getJsonSchema() array< string, mixed >$
@@ -584,8 +575,7 @@ direction LR
584575
namespace AiClientNamespace.Messages.Enums {
585576
class MessagePartTypeEnum {
586577
TEXT
587-
INLINE_FILE
588-
REMOTE_FILE
578+
FILE
589579
FUNCTION_CALL
590580
FUNCTION_RESPONSE
591581
}
@@ -667,14 +657,14 @@ direction LR
667657
+getJsonSchema() array< string, mixed >$
668658
%% The following utility methods transform the result candidates into a specific shape.
669659
+toText() string
670-
+toImageFile() FileInterface
671-
+toAudioFile() FileInterface
672-
+toVideoFile() FileInterface
660+
+toImageFile() File
661+
+toAudioFile() File
662+
+toVideoFile() File
673663
+toMessage() Message
674664
+toTexts() string[]
675-
+toImageFiles() FileInterface[]
676-
+toAudioFiles() FileInterface[]
677-
+toVideoFiles() FileInterface[]
665+
+toImageFiles() File[]
666+
+toAudioFiles() File[]
667+
+toVideoFiles() File[]
678668
+toMessages() Message[]
679669
}
680670
class TokenUsage {
@@ -730,26 +720,25 @@ direction LR
730720
namespace AiClientNamespace.Util {
731721
class CandidatesUtil {
732722
+toTexts(Candidate[] $candidates) string[]$
733-
+toImageFiles(Candidate[] $candidates) FileInterface[]$
734-
+toAudioFiles(Candidate[] $candidates) FileInterface[]$
735-
+toVideoFiles(Candidate[] $candidates) FileInterface[]$
723+
+toImageFiles(Candidate[] $candidates) File[]$
724+
+toAudioFiles(Candidate[] $candidates) File[]$
725+
+toVideoFiles(Candidate[] $candidates) File[]$
736726
+toFirstText(Candidate[] $candidates) string$
737-
+toFirstImageFile(Candidate[] $candidates) FileInterface$
738-
+toFirstAudioFile(Candidate[] $candidates) FileInterface$
739-
+toFirstVideoFile(Candidate[] $candidates) FileInterface$
727+
+toFirstImageFile(Candidate[] $candidates) File$
728+
+toFirstAudioFile(Candidate[] $candidates) File$
729+
+toFirstVideoFile(Candidate[] $candidates) File$
740730
}
741731
class MessageUtil {
742732
+toText(Message $message) string$
743-
+toImageFile(Message $message) FileInterface$
744-
+toAudioFile(Message $message) FileInterface$
745-
+toVideoFile(Message $message) FileInterface$
733+
+toImageFile(Message $message) File$
734+
+toAudioFile(Message $message) File$
735+
+toVideoFile(Message $message) File$
746736
}
747737
class RequirementsUtil {
748738
+inferRequirements(Message[] $messages, ModelConfig $modelConfig) ModelRequirements$
749739
}
750740
}
751741
752-
<<interface>> FileInterface
753742
<<interface>> OperationInterface
754743
<<interface>> ResultInterface
755744
<<Enumeration>> MessageRoleEnum
@@ -772,8 +761,7 @@ direction LR
772761
PromptBuilder .. EmbeddingOperation : creates
773762
MessageBuilder .. Message : creates
774763
Message "1" *-- "1..*" MessagePart
775-
MessagePart "1" o-- "0..1" InlineFile
776-
MessagePart "1" o-- "0..1" RemoteFile
764+
MessagePart "1" o-- "0..1" File
777765
MessagePart "1" o-- "0..1" FunctionCall
778766
MessagePart "1" o-- "0..1" FunctionResponse
779767
GenerativeAiOperation "1" o-- "0..1" GenerativeAiResult
@@ -788,9 +776,6 @@ direction LR
788776
OperationInterface ..> OperationStateEnum
789777
GenerativeAiOperation ..> OperationStateEnum
790778
Candidate ..> FinishReasonEnum
791-
FileInterface <|-- InlineFile
792-
FileInterface <|-- RemoteFile
793-
FileInterface <|-- LocalFile
794779
Message <|-- UserMessage
795780
Message <|-- ModelMessage
796781
Message <|-- SystemMessage

0 commit comments

Comments
 (0)