Revise proposed architecture PR with fluent API class diagrams#10
Conversation
…anize overview diagrams for easier understanding.
…te not formally using the builder pattern.
| +withImageFile(File $file) self | ||
| +withAudioFile(File $file) self | ||
| +withVideoFile(File $file) self | ||
| +withFunctionResponse(FunctionResponse $functionResponse) self |
There was a problem hiding this comment.
It adds a function response as a message part, typically this needs to be used in a user message, in response to the LLM returning a function call message part.
Technically similar to the other methods here that add message parts.
| +generateEmbeddings() Embedding[] | ||
| } | ||
|
|
||
| class MessageBuilder { |
There was a problem hiding this comment.
What is a message as opposed to a prompt?
There was a problem hiding this comment.
A Message is the main data transfer object to communicate between the user and the LLM. There are three types of Messages: user, model, and system messages.
A "prompt" in this SDK is not really an actual thing. It's a higher-level overarching term for what could be a single user message, or many user and model messages (in case of history), or a user message with a bunch of configuration arguments.
I used the name PromptBuilder to relate to that overarching term, but we could go with a different name. Maybe something like AiRequestBuilder could be used instead.
The reason there's a MessageBuilder in addition to the (what is called now) PromptBuilder is to easily be able to create Message objects, which is mostly relevant when using PromptBuilder::withHistory().
| +message(?string $text) MessageBuilder$ | ||
| } | ||
|
|
||
| class PromptBuilder { |
There was a problem hiding this comment.
This will also have a bunch of getter methods so the object consumer can do it's thing, unless you're planning on having a separate DTO that goes the model?
There was a problem hiding this comment.
Yeah, the model will receive this in a different way, see the detailed class diagram. For the most part, it's 1 or more Message objects, and an AiModelConfig object.
|
Excited to see this! Left a few thoughts and questions, @felixarntz! |
…nterfaces to use `TextToSpeechConversion`.
This PR simply updates the branch for #2 with class diagrams that encompass the fluent API (since I had separately explored them in its own branch prior to today's discussion).
A quick review shall be sufficient here, as all of this will still have to undergo a more comprehensive review as part of #2.
After merging this into #2, a good next step would be to update the code examples, ideally with a side-by-side comparison of both consumer / implementor facing APIs (fluent API and traditional method call API).