Skip to content

Commit

Permalink
Add GPT-4 models. Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Krivoblotsky committed Mar 19, 2023
1 parent 42eb848 commit 2609478
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Sources/OpenAI/Public/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ public extension Model {
static let textEmbeddingAda = "text-embedding-ada-002"
static let gpt3_5Turbo = "gpt-3.5-turbo"
static let gpt3_5Turbo0301 = "gpt-3.5-turbo-0301"

static let gpt4 = "gpt-4"
static let gpt4_0134 = "gpt-4-0314"
static let gpt4_32k = "gpt-4-32k"
static let gpt4_32k_0314 = "gpt-4-32k-0314"
}
5 changes: 4 additions & 1 deletion Tests/OpenAITests/OpenAITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ final class OpenAITests: XCTestCase {
}

func testChatsAsync() async throws {
let query = OpenAI.ChatQuery(model: .gpt3_5Turbo, messages: [.init(role: "user", content: "who are you")], temperature: 1, top_p: 1, n: 1, stream: false, stop: nil, max_tokens: 100, presence_penalty: 0, frequency_penalty: 0, logit_bias: nil, user: nil)
let query = OpenAI.ChatQuery(model: .gpt4, messages: [
.init(role: .system, content: "You are Librarian-GPT. You know everything about the books."),
.init(role: .user, content: "Who wrote Harry Potter?")
])
let result = try await openAI.chats(query: query)
XCTAssertFalse(result.choices.isEmpty)
}
Expand Down

0 comments on commit 2609478

Please sign in to comment.