Skip to content

Commit f4e7ae1

Browse files
authored
Updated with iOS instructions (#29)
* Updated with iOS instructions * Art for iOS * Right path for images
1 parent 4799f72 commit f4e7ae1

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,44 @@
33
![Build Status](https://github.com/yml-org/chatgpt-sdk/actions/workflows/test.yml/badge.svg?branch=main)
44
![Y-ChatGPT SDK](https://github.com/yml-org/chatgpt-sdk/raw/main/art/logo.png)
55

6-
# YChatGPT (Working in Progress 🚧)
6+
# YChatGPT
77

88
ChatGPT is a large language model developed by OpenAI that is trained to generate human-like text based on a given prompt or context.
99

1010
YChatGPT aims to abstract all API call logic from ChatGPT for multiple platforms. YChatGPT is a Kotlin Multiplatform (KMP) project, that generates artifacts for both iOS and Android.
1111

1212

13+
## iOS setup
14+
15+
- Go to your project’s file settings and click "Add Package":
16+
17+
![Y-ChatGPT iOS first screenshot](https://github.com/yml-org/chatgpt-sdk/raw/blob/art/ios-1.png)
18+
19+
- To add a new package, search for https://github.com/yml-org/chatgpt-sdk.git in the top right corner:
20+
21+
![Y-ChatGPT iOS second screenshot](https://github.com/yml-org/chatgpt-sdk/raw/blob/art/ios-2.png)
22+
23+
Once you have found the package click the "Add Package" button to add it to your project. Now you can start using the SDK in your iOS project!
24+
25+
See the code snippet below on how to initialize and use it:
26+
27+
```swift
28+
var yChatGpt: YChatGpt {
29+
YChatGptCompanion.shared.create(apiKey: "your-api-key")
30+
}
31+
32+
do {
33+
let result = try await chatGpt.completion()
34+
.setInput(input: "Say this is a test.")
35+
.setMaxTokens(tokens: 1024)
36+
.saveHistory(isSaveHistory: false)
37+
.set... // you can set more parameters
38+
.execute()
39+
} catch {
40+
// catch any error that may occurs on api call.
41+
}
42+
```
43+
1344
## Android setup
1445

1546
Add the following line to import the library via Gradle. First, make sure Maven Central has been added:

art/ios-1.png

409 KB
Loading

art/ios-2.png

405 KB
Loading

0 commit comments

Comments
 (0)