2.0.11 • Published 2 days ago

@zitterorg/tempora-sapiente-veritatis v2.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

Gradio Chatbot

A tool that can automatically convert Huggingface Spaces, Modelscope Studios and Gradio ChatBot into free APIs. It basically supports any space with a chatbot, and currently perfectly supports many model spaces such as GPT4Free, ChatGPT, Llama 2, Vicuna, MPT-30B, Falcon, ChatGLM, Qwen and so on.

English | 中文

NPM Apache 2.0 License

Online Demo: https://weaigc.github.io/@zitterorg/tempora-sapiente-veritatis

Due to the current high demand on the ChatGPT space on Huggingface, there is a noticeable delay in response time. If you have your own ChatGPT account, it is recommended to use gpt-web.

Quick Start

NPM

  • Experience a free ChatGPT.
npx @zitterorg/tempora-sapiente-veritatis
# or
npm install -g @zitterorg/tempora-sapiente-veritatis
# call the default model
chatbot
  • Experience Llama2.
chatbot 2
# or
chatbot https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat

More usage just type chatbot help

Docker

docker build . -t gradio-server
docker run --rm -it -p 8000:8000 gradio-server

asciicast

Installation

You can use npm or yarn to install @zitterorg/tempora-sapiente-veritatis. Node version 18 or higher is required.

npm install @zitterorg/tempora-sapiente-veritatis
# or
yarn add @zitterorg/tempora-sapiente-veritatis

Usage

Currently supports three modes.

CLI mode

Refer to Quickstart.

API Service

To make it easy to use, two forms of interfaces are provided.

Streaming output, simply visit http://localhost:8000/api/conversation?model=0&text=hello. Non-streaming output, the calling method is the same as ChatGPT API. The following is an example of a call.

API Function

import { GradioChatBot } from '@zitterorg/tempora-sapiente-veritatis'

const bot = new GradioChatBot();

async function start() {
  const message = await bot.chat('hello', {
    onMessage(partialMsg) {
      console.log('stream output:', partialMsg);
    }
  });
  console.log('message', message);
}

start();

You can also input the spatial address you want to convert, such as https://huggingface.co/spaces/h2oai/h2ogpt-chatbot.

import { GradioChatBot } from '@zitterorg/tempora-sapiente-veritatis'

const bot = new GradioChatBot({
  url: 'https://huggingface.co/spaces/h2oai/h2ogpt-chatbot',
  fnIndex: 35,
}); // 调用自定义 ChatBot 模型

async function start() {
  console.log(await bot.chat('Hello'));
}

In addition, the NPM package has built-in support for 10 popular spaces from Hugging Face Spaces and Modelscope Studios. You can directly use the model index to access them. Please refer to the Model List for more details.

import { GradioChatBot } from '@zitterorg/tempora-sapiente-veritatis';

const bot = new GradioChatBot('1');
async function start() {
  console.log(await bot.chat('Tell me about ravens.'));
}

start();

For more examples, please visit the directory: Examples .

Note: Some models on Hugging Face may collect the information you input. If you have data security concerns, it is recommended not to use them, and using self-hosted models is a better choice.

Using OpenAI

Python

import openai
openai.api_key = "dummy"
openai.api_base = "http://127.0.0.1:8080/v1"

# create a chat completion
chat_completion = openai.ChatCompletion.create(model="10", messages=[{"role": "user", "content": "Hello"}])

# print the completion
print(chat_completion.choices[0].message.content)

For more usage instructions, please refer to https://github.com/openai/openai-python

Node.js

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'http://127.0.0.1:8080/v1'
});

async function main() {
  const stream = await openai.chat.completions.create({
    model: '10',
    messages: [{ role: 'user', content: 'Hello' }],
    stream: true,
  });
  for await (const part of stream) {
    process.stdout.write(part.choices[0]?.delta?.content || '');
  }
}

main();

For more usage instructions, please refer to https://github.com/openai/openai-node

API Document

See API Document

Model List

IndexTypeDescriptionModel
0Huggingface SpacesChatGPThttps://huggingface.co/spaces/yizhangliu/chatGPT
1Huggingface SpacesGPT Freehttps://huggingface.co/spaces/justest/gpt4free
2Huggingface SpacesLlama2 Spaceshttps://huggingface.co/spaces/ysharma/Explore_llamav2_with_TGI
3Huggingface SpacesMosaicML MPT-30B-Chathttps://huggingface.co/spaces/mosaicml/mpt-30b-chat
4Huggingface SpacesFalcon Chathttps://huggingface.co/spaces/HuggingFaceH4/falcon-chat
5Huggingface SpacesStar Chathttps://huggingface.co/spaces/HuggingFaceH4/starchat-playground
6Huggingface SpacesChatGLM2https://huggingface.co/spaces/mikeee/chatglm2-6b-4bit
7Huggingface SpacesChatGLMhttps://huggingface.co/spaces/multimodalart/ChatGLM-6B
8Huggingface SpacesVicunahttps://chat.lmsys.org/
9Huggingface SpacesQwen 7B Chathttps://huggingface.co/spaces/mikeee/qwen-7b-chat
10ModelScopeQwen 7B Chathttps://modelscope.cn/studios/qwen/Qwen-7B-Chat-Demo/summary
11ModelScopeChatGLM2https://modelscope.cn/studios/AI-ModelScope/ChatGLM6B-unofficial/summary
12ModelScopeJiang Ziya V1.1https://modelscope.cn/studios/Fengshenbang/Ziya_LLaMA_13B_v1_online/summary
13ModelScopeCharacter Dialogue Chatbot developed by Alibaba DAMO Academyhttps://modelscope.cn/studios/damo/role_play_chat/summary

More useful models are welcome to contribute in the issue section.

Change Log

See CHANGELOG.md

Compatibility

  • This package supports node >= 18.

Credits

License

Apache 2.0 © LICENSE.

kinesisnamesconcurrencyconfigurableformsmkdirpfileeventEmitterES2019typedarraysfromdynamodbamazonPushdefinePropertycompilerfindLastIndexRxJSfluxHyBihigher-orderECMAScript 2023envemrnegative zerotaskrequirevalidatedependencieses2016optimizermatchesexecquerystringsymbolsnodefastclonextermboundindicatorclassesSetwalktypedarrayconcatMaptypeofplugintapeio-tscollection@@toStringTagwatchFilecallpolyfillCSSStyleDeclarationlastserializationstructuredCloneflattenoffsetlookzeromkdirspersistentdayjssetImmediateworkerstylingendertypedsyntaxerrorequalrgbidtslibmkdirMicrosofttelephonecommandcore-jsset__proto__cryptoroute53queueMicrotaskgroupmime-dbopeniteratorbcryptworkspace:*argvargsserializewordbreakparsermimejsonrfc4122sharedObject.defineProperty$.extendsomepromiseObject.valuesFloat32Arrayvariables in cssclientiamIteratorECMAScript 3descriptioncurlsetterpruneAsyncIteratorextracallbackhttpscryptownargparseinmapreduceajvArray.prototype.flatdomwatchingebsasserttoobjectobjreduceartcensori18ntyperegexeventsformatremovevestutilityreactfunctionsprototypeflagscommanderjsonpathes5sharedarraybufferstreams2moverobusteast-asian-widthmergelimitedreact-hook-formwidthomiteventDispatcherEStimefast-deep-cloneworkflowcharactersisConcatSpreadableajaxbluebirdenvironmentwritebundlercolumnbundlingconcatnodejswatchsymlinksfullwidthdefinesymbolrateUint16Arraycreate256queueclassnamecachelessefficientaccessortapsuperstructextensionlintes2017WebSockettrimhasOwnelasticachees7byteLengthpackageoutputagentRFC-6455coreObject.keysvaluesnativecloneObject.entrieslazydebugwarningfpsmake dirJSONtc39stringifieres8cjkprogressapiawsthrottlefastifycheckdependency managergetasyncelectronchannelpostcss-pluginmruless.jsfindLastassertionunicodemoduleredirectforEachregularlogoptimistparsingsimpledbschemetoolsObservablecallboundweaksetespreeReactiveExtensionsreact-testing-librarystringbreakglacierObservablesnameimportexportfile systemprettymodulescloudtrailreplaySymbolincludescompile lessbufferwgetfastcopymulti-packageES3emittextWeakSetES2021loadbalancingbootstrap lessbusynested cssawesomesaucehasOwnPropertyimmutableparentsawaitweakmaproutingcopyschemajestdatastructurewhichgdprfast-copyauthenticationauthtscoerciblespinnersdeep-copynpmtrimRightutilitiesObject.assignspeedhooksreadablesearchtrimEndmatchwritabledupleximmerloadingdeleteRegExp#flagscloudwatchECMAScript 2021findes-shimswalkingobjectqsgroupByfigletec2graphqlonceroutedatadeterministicpreserve-symlinkscontainsencryptionrecursivecolorsECMAScript 6ECMAScript 2018pushstatelessdotenvrm -frpredictablejsxtypanion_.extend
2.0.11

2 days ago

2.0.10

3 days ago

2.0.9

4 days ago

2.0.8

5 days ago

2.0.7

6 days ago

2.0.6

7 days ago

1.0.6

8 days ago

1.0.5

9 days ago

1.0.4

10 days ago

1.0.2

12 days ago

1.0.3

11 days ago

1.0.1

13 days ago

1.0.0

14 days ago