openai_client 0.0.2 openai_client: ^0.0.2 copied to clipboard
An unofficial, platform independent, client for accessing different AI models developed by OpenAI.
The OpenAI API can be applied to virtually any task that involves understanding or generating natural language or code. They offer a spectrum of models with different levels of power suitable for different tasks, as well as the ability to fine-tune your own custom models.
This is an unofficial client, written purely in Dart that allows you to easily use the API in your Dart or Flutter projects.
Getting Started #
In order to use the API, you need to have an API key. You can get one here and once you have it, you can use it in the client passing the key itself in the OpenAIConfiguration
constructor.
// Create the configuration
final conf = OpenAIConfiguration(
apiKey: 'Your API key',
organizationId: 'Your organization ID', // Optional
);
// Create a new client
final client = OpenAIClient(configuration: conf);
Debugging #
For testing and debugging purposes, you can use the built-in Logger
to more easily check the status of requests and responses.
By default, the Logger
is disabled. You can enable it by setting the enableLogging
property to true
.
final client = OpenAIClient(
...
enableLogging: true,
);
Documentation #
The full documentation of the project is available here. All the methods are documented, and you can easily check the parameters that you can pass to them.
Contributing #
If you want to contribute to openai_client
, please make sure to review the contribution guidelines.
This project makes use of GitHub issues for tracking requests and bugs only, so please don't use issues for general questions and discussion.
Examples #
The provided example is a simple command line application that allows you to test the client. You can find it in the example
folder.