firebase-gpt-chat-completion

Function for use of GPT Api for chat completion in Firebase

https://github.com/klich3/firebase-gpt-chat-completion

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.9%) to scientific vocabulary

Keywords

firestore firestore-function nodejs16 react reactfire
Last synced: 6 months ago · JSON representation ·

Repository

Function for use of GPT Api for chat completion in Firebase

Basic Info
  • Host: GitHub
  • Owner: klich3
  • License: mit
  • Language: JavaScript
  • Default Branch: main
  • Homepage:
  • Size: 20.5 KB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
firestore firestore-function nodejs16 react reactfire
Created over 2 years ago · Last pushed over 2 years ago
Metadata Files
Readme Funding License Citation

README.md

Firebase Cloud Functions for GPT Chat Completion

firebase+gpt

Example of ChatGPT implementation in Firebase with functions. They are via internal calls with call and response. Issue:: This method seems to be slower than the other Stream method because it does not stream.

SETUP

In functions folder create file .env with your OpenAI Api key.

Sample: text OPEN_AI_KEY="sk-<your key here>"

SETUP WITH CUSTOM FUNCTIONS FOLDER

To use functions in a custom folder different from the default, suppose the destination folder is functions inside we create a new folder named gpt-chat-completion and copy files from this project that are inside the functions folder. Then edit the firebase.json file from the root folder of your project.

json { ... "firestore": { ... }, ... "functions": [ { "source": "functions/gpt-chat-completion", "codebase": "gpt-chat-completion", "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run lint"], "ignore": [ "node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log" ], "runtime": "nodejs16" } ] ... }

Deploy

Run firebase deploy --only functions:gpt-chat-completion

Sample usage in REACT

```javascript

import { httpsCallable } from "firebase/functions"; import { useFunctions, } from "reactfire"; ...

const functions = useFunctions(); const gptPrompt = httpsCallable(functions, "gptPrompt");

gptPrompt({prompt: [{role: "user", content: "Hello world"}]})

```

Owner

  • Name: Anton Sychev
  • Login: klich3
  • Kind: user
  • Location: Barcelona
  • Company: @Sychev

FullStack developer passionate about decentralized web tech, AI, Web 2.0, FrontEnd/BackEnd, databases, and system optimization. Focused on R&D.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: gpt-chat-completion
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Anton
    family-names: Sychev
    email: anton@sychev.xyz
repository-code: 'https://github.com/klich3/firebase-gpt-chat-completion.git'
abstract: GPT Chat Completion Cloud Functions for Firebase
keywords:
  - gpt
  - chatGPT
  - firebase
  - functions
license: MIT
version: 0.1.0

GitHub Events

Total
  • Watch event: 1
  • Fork event: 1
Last Year
  • Watch event: 1
  • Fork event: 1

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 4
  • Total Committers: 1
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Anton Sychev 2****3 4

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

functions/package.json npm
  • eslint ^8.40.0 development
  • firebase-admin ^11.8.0
  • firebase-functions ^4.4.0
  • openai ^3.2.1