Releases: 0xOpenBytes/ChatService
Releases · 0xOpenBytes/ChatService
0.1.0
ChatService
🤖 Chat with GPT
ChatService is a Swift package that provides a simple API for chatting with an AI-powered bot based on GPT (Generative Pretrained Transformer) architecture. The package uses OpenAI's GPT models to generate responses to user inputs, and provides an interface for managing chats and chat history.
Usage
To use ChatService in your app, first import the module:
import ChatService
Then, create an instance of ChatService with your OpenAI API key:
let chatService = ChatService(key: "YOUR_OPENAI_API_KEY")
You can then use the completion method to generate a response to a user message:
let response: String = try await chatService.completion(for: "Hello?")
You can access the chat history using the chatHistory property of the Chat object:
let chatHistory: [ChatService.Chat] = chat.chatHistory
Full Changelog: https://github.com/0xOpenBytes/ChatService/commits/0.1.0