GithubHelp home page GithubHelp logo

swiftopenai's Introduction

👋 ¡Hola! Bienvenido a mi código 🔥

Portada Twitter Follow
Youtube Views YouTube Channel Subscribers
GitHub Stars GitHub Followers
Discord

Si has llegado hasta aquí, puedes:

swiftopenai's People

Contributors

swiftbeta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftopenai's Issues

Support iOS 15.0+

I'd like to migrate to use this package, but I get the following error when I attempt to import SwiftOpenAI:

Compiling for iOS 15.0, but module 'SwiftOpenAI' has a minimum deployment target of iOS 16.0

My app is committed to supporting iOS 15.0+ so this is currently preventing me from switching to this package.

Demo App Help?

I've added my API Key to the SwiftOpenAI.plist file. The app launches, but all requests are failing. E.g., when creating an image:

Error creating Images with DALL·E: The operation couldn’t be completed. (SwiftOpenAI.OpenAIAPIError error 1.)

Am I missing any other requirements? Thanks

Streaming requests end with DecodingError

Sample code (adapted from the example given):

var openAI = SwiftOpenAI(apiKey: "sk-...")

for try await newMessage in try! await openAI.createChatCompletionsStream(model: .gpt3_5(.turbo),
                                                                          messages: [.init(text: "Hello, how are you?", role: "user")],
                                                                          optionalParameters: .init(stream: true))
{
	dump(newMessage)
	let newToken = newMessage.choices.first?.delta?.content
	print("New Message Received: \(newToken) ")
}

While the code works and does stream all responses properly, it always fails with:

Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around line 1, column 1." UserInfo={NSDebugDescription=Invalid value around line 1, column 1., NSJSONSerializationErrorIndex=1})))

Wrapping the calls in do {.. } catch DecodingError.dataCorrupted(let context) works fine however, but should be handled by your framework.

openAI "Call Functions" feature

I was checking and I think that at the moment, the parameter for the function call feature is not yet included, since developers interact with the model and retrieve structured data.

Function calling in the OpenAI API is a mechanism that allows models to detect when a specific function needs to be invoked based on user input. Once detected, the model responds with JSON that adheres to the function signature.

No Working: uncaught signal: 5

Hello,

I am trying to use the library of a M1 Max, but i am getting the following error:

Plug-in ended with uncaught signal: 5)

Any idea how to solve it? I have been investigating a little and It seems that some of the dependences are not compatible with the apple SoC.

Thanks in advance

App example?

Hi,

I host one of these OpenAI-API compatible inference servers for academics ( just like https://chat.lmsys.org ), and I was thinking about making an IOS app which would talk to such a server.

Turns out I'm a zero on swift, and Xcode is overwhelming from the first sight, to say the least.

The examples in the README lead me to nowhere. I have absolutely no idea how to transform this repo into a useful app.

A minimal example which one could clone and try would be amazingly welcome.

A second thing is that this repo is hardcoded to talk to OpenAI, but not to openai-compatible servers. This is something you might have some interest in. Check the example of https://Continue.dev - they allow you also to point to private inference servers.

Thanks!

Is there a way to cancel createChatCompletionsStream ?

Firstly - thank you for a great library. It has made it really easy to get streaming chat completions.

One issue though; I can't see a way to terminate the stream once it has started. Am I missing something?

thank you.

Fine tuning model usage

Looking at the options provided in the OpenAIModelType there is no such option to add my fine tuned model. Is it possible to create this feature?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.