Orientação gerada a partir de informações públicas. Apenas para referência.
Um cliente Dart para a API não oficial do ChatGPT, permitindo conclusão de texto e respostas em streaming através do endpoint v1/completions. Projetado para aplicativos Flutter, suporta múltiplas plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux. O pacote simplifica a integração com as funcionalidades de geração de texto do ChatGPT, permitindo que desenvolvedores obtenham conteúdo gerado por IA em tempo real. Ideal para interfaces de chat, assistentes de conteúdo e aplicações interativas que exigem processamento de linguagem natural.
Casos de uso
Aplicações de bate-papo em tempo real
Geração de conteúdo impulsionada por IA
Ferramentas de aprendizagem interativa
Sistemas de resposta automática
Recursos de sugestão de código
Principais recursos
Suporta conclusão de texto
Respostas em tempo real
Compatibilidade multiplataforma
Interface de API simples
Acesso não oficial, mas funcional ao ChatGPT
Indicado para
Desenvolvedores Flutter construindo recursos de chat com IA
Aplicativos que precisam de geração de texto em tempo real
Protótipos que exigem integração rápida de IA
Considerações
API não oficial—pode parar de funcionar com atualizações
Limites de taxa e estabilidade dependem do serviço externo
Sem suporte oficial da OpenAI
Requer gerenciamento de chave de API
Limitado a pontos finais de conclusão, não ao histórico completo de conversas
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Dart client for the unofficial ChatGPT API. Support Text Completeion and stream response from v1/completions.
Features
Text completions without stream response
Text completions with stream response
Getting started
Install package
flutter pub add chatgpt_completions
Usage
Initialize instance
/// Generate api key from openai console: https://platform.openai.com/account/api-keysChatGPTCompletions.instance.initialize(apiKey: "api_key_here");
Text completions without stream response (stream: false)
// Using GPT-3.5-TurboawaitChatGPTCompletions.instance.textCompletions(
TextCompletionsParams(
// using messagesTurbo insteal of prompt
messagesTurbo: [
MessageTurbo(
role: TurboRole.user,
content: "What's Flutter?",
),
],
model: GPTModel.gpt3p5turbo, // --> switch to gpt-3.5-turbo model
),
onStreamValue: (characters) {
responseWithStream += characters;
print(responseWithStream);
},
onStreamCreated: (subscription) {
responseSubscription = subscription;
},
// Debounce 100ms for receive next value
debounce: constDuration(milliseconds: 100),
);
License - lambiengcode
MIT License
Copyright (c) 2023 lambiengcode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.