Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 575 Bytes

README.md

File metadata and controls

24 lines (18 loc) · 575 Bytes

SwiftAI

🛸 Future: AI agents as declarative Swift?

✨ Now: Easy use of Grok, Claude and ChatGPT:

import SwiftAI

func demonstrate() async throws {
    let prompt = "What is the meaning of life? Be concise and to the point."
    
    let chatAIs: [ChatAI] = [
        XAI.Grok(.grokBeta, key: .myKey),
        Anthropic.Claude(.claude_3_5_Sonnet, key: .myKey),
        OpenAI.ChatGPT(.gpt_4o, key: .myKey)
    ]
    
    for chatAI in chatAIs {
        let answer = try await chatAI.complete(chat: [Message(prompt)])
        print(answer.content)
    }
}