You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,7 @@ to stay on the bleeding edge.
102
102
SwiftOpenAI supports various providers that are OpenAI-compatible, including but not limited to:
103
103
104
104
-[Azure OpenAI](#azure-openai)
105
+
-[Anthropic](#anthropic)
105
106
-[Gemini](#gemini)
106
107
-[Ollama](#ollama)
107
108
-[Groq](#groq)
@@ -3592,6 +3593,31 @@ let vectorStoreFiles = try await service.listVectorStoreFilesInABatch(vectorStor
3592
3593
3593
3594
⚠️ We currently support Only Assistants Beta 2. If you need support for Assistants V1, you can access it in the jroch-supported-branch-for-assistants-v1 branch or in the v2.3 release.. [Check OpenAI Documentation for details on migration.](https://platform.openai.com/docs/assistants/migration))
3594
3595
3596
+
## Anthropic
3597
+
3598
+
Anthropic provides OpenAI compatibility, for more, visit the [documentation](https://docs.anthropic.com/en/api/openai-sdk#getting-started-with-the-openai-sdk)
3599
+
3600
+
To use Claude models with `SwiftOpenAI` you can.
3601
+
3602
+
```swift
3603
+
let anthropicApiKey = ""
3604
+
let openAIService = OpenAIServiceFactory.service(apiKey: anthropicApiKey,
3605
+
overrideBaseURL: "https://api.anthropic.com",
3606
+
overrideVersion:"v1")
3607
+
```
3608
+
3609
+
Now you can create the completio parameters like this:
3610
+
3611
+
```swift
3612
+
let parameters =ChatCompletionParameters(
3613
+
messages: [.init(
3614
+
role: .user,
3615
+
content: "Are you Claude?")],
3616
+
model: .custom("claude-3-7-sonnet-20250219"))
3617
+
```
3618
+
3619
+
For a more complete Anthropic Swift Package, you can use [SwiftAnthropic](https://github.com/jamesrochabrun/SwiftAnthropic)
3620
+
3595
3621
## Azure OpenAI
3596
3622
3597
3623
This library provides support for both chat completions and chat stream completions through Azure OpenAI. Currently, `DefaultOpenAIAzureService` supports chat completions, including both streamed and non-streamed options.
0 commit comments