-
Notifications
You must be signed in to change notification settings - Fork 9
Revise proposed architecture PR with fluent API class diagrams #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a message as opposed to a prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Message
is the main data transfer object to communicate between the user and the LLM. There are three types of Message
s: 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Great work! 🎉
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).