@@ -86,44 +86,71 @@ The definitive, open-source Swift framework for interfacing with generative AI.
86
86
87
87
## Initialize an AI Client
88
88
89
- Initialize an instance of ` LLMRequestHandling ` with an API provider of your choice. Here are some examples:
89
+ Initialize an instance of an AI API provider of your choice. Here are some examples:
90
90
91
91
``` swift
92
92
import AI
93
93
94
+ // OpenAI / GPT
94
95
import OpenAI
95
- import Anthropic
96
- import Mistral
97
96
98
- // OpenAI / GPT
99
- let client: any LLMRequestHandling = OpenAI. Client ( apiKey : " YOUR_KEY " )
97
+ let client: OpenAI.Client = OpenAI. Client ( apiKey : " YOUR_API_KEY " )
98
+
100
99
// Anthropic / Claude
101
- let client: any LLMRequestHandling = Anthropic.Client (apiKey : " YOUR_KEY" )
100
+ import Anthropic
101
+
102
+ let client: Anthropic.Client = Anthropic.Client (apiKey : " YOUR_API_KEY" )
103
+
102
104
// Mistral
103
- let client: any LLMRequestHandling = Mistral.Client (apiKey : " YOUR_KEY" )
105
+ import Mistral
106
+
107
+ let client: Mistral.Client = Mistral.Client (apiKey : " YOUR_API_KEY" )
108
+
109
+ // Groq
110
+ import Groq
111
+
112
+ let client: Groq.Client = Groq.Client (apiKey : " YOUR_API_KEY" )
113
+
114
+ // ElevenLabs
115
+ import ElevenLabs
116
+
117
+ let client: ElevenLabs.Client = ElevenLabs.Client (apiKey : " YOUR_API_KEY" )
118
+
104
119
```
105
120
106
- You can now use ` client ` as an interface to an LLM as provided by the underlying provider.
121
+ You can now use ` client ` as an interface to the supported providers.
107
122
108
123
## Supported Models
109
124
Each AI Client supports multiple models. For example:
110
125
111
126
``` swift
112
127
// OpenAI Models
113
- let gpt_4o_Model = OpenAI.Model .gpt_4o
114
- let gpt_4_Model = OpenAI.Model .gpt_4
115
- let gpt_3_5_Model = OpenAI.Model .gpt_3_5
116
- let otherGPTModels = OpenAI.Model .chat (.gpt_OTHER_MODEL_OPTIONS )
128
+ let gpt_4o_Model: OpenAI.Model = .gpt_4o
129
+ let gpt_4_Model: OpenAI.Model = .gpt_4
130
+ let gpt_3_5_Model: OpenAI.Model = .gpt_3_5
131
+ let otherGPTModels: OpenAI.Model = .chat (.gpt_OTHER_MODEL_OPTIONS )
117
132
118
133
// Anthropic Models
119
- let caludeHaikuModel = Anthropic.Model .haiku
120
- let claudeSonnetModel = Anthropic.Model .sonnet
121
- let claudeOpusModel = Anthropic.Model .opus
134
+ let caludeHaikuModel: Anthropic.Model = .haiku
135
+ let claudeSonnetModel: Anthropic.Model = .sonnet
136
+ let claudeOpusModel: Anthropic.Model = .opus
122
137
123
138
// Mistral Models
124
- let mistralTiny = Mistral.Model .mistral_tiny
125
- let mistralSmall = Mistral.Model .mistral_small
126
- let mistralMedium = Mistral.Model .mistral_medium
139
+ let mistralTiny: Mistral.Model = .mistral_tiny
140
+ let mistralSmall: Mistral.Model = Mistral.Model .mistral_small
141
+ let mistralMedium: Mistral.Model = Mistral.Model .mistral_medium
142
+
143
+ // Groq Models
144
+ let gemma_7b: Groq.Model = .gemma_7b
145
+ let llama3_8b: Groq.Model = .llama3_8b
146
+ let llama3_70b: Groq.Model = .llama3_70b
147
+ let mixtral_8x7b: Groq.Model = .mixtral_8x7b
148
+
149
+ // ElevenLabs Models
150
+ let multilingualV2: ElevenLabs.Model = .MultilingualV2
151
+ let turboV2: ElevenLabs.Model = .TurboV2 // English
152
+ let multilingualV1: ElevenLabs.Model = .MultilingualV1
153
+ let englishV1: ElevenLabs.Model = .EnglishV1
127
154
```
128
155
129
156
## Completions
0 commit comments