Skip to content

SwiftAI, Swift, AI, Grok, xAI, LLM, Anthropic, Claude, OpenAI, ChatGPT

Notifications You must be signed in to change notification settings

codeface-io/SwiftAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
    }
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy