100% SwiftUI macOS GPT/LLM Client with Prompt Engineering support. Microsoft's Azure OpenAI functionality included.
100% SwiftUI GPT/LLM Client with Prompt Engineering support. With Microsoft's Azure OpenAI functionality.
General Query View | Prompt Studio |
---|---|
Development Roadmap
Table of Contents
macOS 12.4+
Build passing 🟢Locally Diverged
SwiftGPT
and swiftui-markdown
from above as well. This kit handles custom prompt/command routing for the applicatoin.Removed
static var AZURE_CONFIG: ChatGPTAzure.Config {
.init(apiKey: "...",
apiVersion: "2023-05-15", //apiVersion not necessary for initialization
resourceName: "...",
deploymentName: "...")
}
Repo will be updated to include this out of the box, front-end side, in the future.
Back in SandGPT: https://github.com/pexavc/Nea/blob/24fbcfbac23eb7f13b84cdee6307211596ee54d0/Services/Sand/Models/SandGPT.swift#L48
Simply build a flow to store the type ChatMessage
prior to using the Swift Package.
private var messages: [ChatMessage] = []
func ask<E: EventExecutable>(_ prompt: String,
withSystemPrompt systemPrompt: String? = nil,
withConfig config: PromptConfig,
stream: Bool = false,
logMessages: Bool = false,
event: E) {
Append the user prompt with the role user
.
self.messages.append(.init(role: .user, content: prompt)) //add user prompt
Append the chat-bot's response with the role assistant
.
reply = try await client.ask(messages: self?.messages ?? [],
withConfig: config)
DispatchQueue.main.async { [weak self] in
self?.isResponding = false
}
if logMessages {
self?.messages.append(.init(role: .assistant, content: reply))
}
event.send(Response(data: reply, isComplete: true, isStream: false))
The role .system
is good for setting a persona prior to message collection.
self?.messages.append(.init(role: .system, content: "Act as..."))
Linking the reset() function in SandGPT()
to clear messages is helpful too:
func reset(messages: Bool = false) {
self.currentTask?.cancel()
self.reqDebounceTimer?.invalidate()
self.replyCompletedTimer?.invalidate()
self.isResponding = false
if messages {
self.messages = []
}
}
Declaritevly update a single window's size whenever an action requires
state.pane?.display {
WindowComponent(WindowComponent.Kind.query)
if addResponse {
WindowComponent(WindowComponent.Kind.divider)
WindowComponent(WindowComponent.Kind.response)
WindowComponent(WindowComponent.Kind.spacer)
WindowComponent(WindowComponent.Kind.shortcutbar)
}
}
Example of Using PopupableView to easily trigger popups in any window instance.
PopupableView(.promptStudio,
size: .init(200, 200),
edge: .maxX, {
RoundedRectangle(cornerRadius: 6)
.frame(width: 60, height: 60)
.foregroundColor(Color(hex: promptColor))
}) {
ColorPicker(hex: $promptColor)
}
.frame(width: 60, height: 60)
Advanced Tuning | Helper Tab |
---|---|
Using Commands | Switching Commands |
---|---|