Skip to content

Commit

Permalink
intermediate commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Nissen committed Oct 29, 2024
1 parent 4480b8c commit 768cbfc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ struct LLMLocalDemoView: View {
// Instantiate the `LLMLocalSchema` to an `LLMLocalSession` via the `LLMRunner`.
let llmSession: LLMLocalSession = runner(
with: LLMLocalSchema(
modelPath: URL(string: "URL to the local model file")!
model: .llama3_8B_4bit,
formatChat: LLMLocalSchema.PromptFormattingDefaults.llama3
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ public struct LLMLocalContextParameters: Sendable {
/// RNG seed of the LLM
var seed: UInt64?

/// If `true`, the mode is set to embeddings only
var embeddingsOnly: Bool

/// Creates the ``LLMLocalContextParameters`` which wrap the underlying llama.cpp `llama_context_params` C struct.
/// Is passed to the underlying llama.cpp model in order to configure the context of the LLM.
///
/// - Parameters:
/// - seed: RNG seed of the LLM, defaults to a random seed.
/// - embeddingsOnly: Embedding-only mode, defaults to `false`.
public init(
seed: UInt64? = nil,
embeddingsOnly: Bool = false
seed: UInt64? = nil
) {
self.seed = seed
self.embeddingsOnly = embeddingsOnly
}
}
9 changes: 2 additions & 7 deletions Tests/UITests/TestApp/LLMLocal/LLMLocalChatTestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ struct LLMLocalChatTestView: View {
} else {
LLMChatViewSchema(
with: LLMLocalSchema(
configuration: .phi3_4bit,
formatChat: { context in
context
.filter { $0.role == .user }
.map { $0.content }
.joined(separator: " ")
}
model: .llama3_8B_4bit,
formatChat: LLMLocalSchema.PromptFormattingDefaults.llama3
)
)
}
Expand Down
11 changes: 10 additions & 1 deletion Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,17 @@ class TestAppLLMLocalUITests: XCTestCase {
sleep(1)

// Chat
let inputTextfield = app.textViews["Message Input Textfield"]
XCTAssertTrue(inputTextfield.exists)

#if !os(macOS)
try app.textViews["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
if UIDevice.current.userInterfaceIdiom == .pad {
inputTextfield.tap()
sleep(1)
inputTextfield.typeText("New Message!")
} else {
try inputTextfield.enter(value: "New Message!", options: [.disableKeyboardDismiss])
}
#else
try app.textFields["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
#endif
Expand Down

0 comments on commit 768cbfc

Please sign in to comment.