Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated with iOS instructions #29

Merged
merged 3 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,44 @@
![Build Status](https://github.com/yml-org/chatgpt-sdk/actions/workflows/test.yml/badge.svg?branch=main)
![Y-ChatGPT SDK](https://github.com/yml-org/chatgpt-sdk/raw/main/art/logo.png)

# YChatGPT (Working in Progress 🚧)
# YChatGPT

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

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.


## iOS setup

- Go to your project’s file settings and click "Add Package":

![Y-ChatGPT iOS first screenshot](https://github.com/yml-org/chatgpt-sdk/raw/blob/art/ios-1.png)

- To add a new package, search for https://github.com/yml-org/chatgpt-sdk.git in the top right corner:

![Y-ChatGPT iOS second screenshot](https://github.com/yml-org/chatgpt-sdk/raw/blob/art/ios-2.png)

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!

See the code snippet below on how to initialize and use it:

```swift
var yChatGpt: YChatGpt {
YChatGptCompanion.shared.create(apiKey: "your-api-key")
}

do {
let result = try await chatGpt.completion()
.setInput(input: "Say this is a test.")
.setMaxTokens(tokens: 1024)
.saveHistory(isSaveHistory: false)
.set... // you can set more parameters
.execute()
} catch {
// catch any error that may occurs on api call.
}
```

## Android setup

Add the following line to import the library via Gradle. First, make sure Maven Central has been added:
Expand Down
Binary file added art/ios-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/ios-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.