Saravanan666/pypi-org huggingface dataset:
Package: chattingtransformer
Chatting TransformerEasy text generation using state of the art NLP models.Chatting Transformer is a Python library for generating text using GPT2. GPT-2 is a language model that was developed by OpenAI that specializes in generating text. By using Chatting Transformer, you can implement and use this model with just two lines of code.InstallationpipinstallchattingtransformerBasic UsagefromchattingtransformerimportChattingGPT2model_name="gpt2"gpt2=ChattingGPT2(model_name)text="In 10 years, AI will "result=gpt2.generate_text(text)print(result)# Outputs: In 10 years, AI will  have revolutionized the way we interact with the world...Available ModelsModelParametersSizegpt2134 M548  MBgpt2-medium335 M1.52 GBgpt2-large774 M3.25 GBgpt2-xl1.5 B6.43 GBfromchattingtransformerimportChattingGPT2gpt2=ChattingGPT2("gpt2")gpt2_medium=ChattingGPT2("gpt2-medium")gpt2_large=ChattingGPT2("gpt2-large")gpt2_xl=ChattingGPT2("gpt2-xl")Predefined MethodsBelow are predfined methods that may be used to determine the output.
To learn more, about these methods, please visit thiswebpage."greedy""beam-search""generic-sampling""top-k-sampling""top-p-nucleus-sampling"fromchattingtransformerimportChattingGPT2gpt2=ChattingGPT2("gpt2")text="I think therefore I "greedy_output=gpt2.generate_text(text,method="greedy")beam_search_output=gpt2.generate_text(text,method="beam-search")generic_sampling_output=gpt2.generate_text(text,method="generic-sampling")top_k_sampling_output=gpt2.generate_text(text,method="top-k-sampling")top_p_nucleus_sampling_output=gpt2.generate_text(text,method="top-p-nucleus-sampling")Custom MethodBelow are the default values for the parameters you may adjust to modify how the model generates text. For more information about the purpose of each parameter, please visit Hugging Face's Transformer documentation on thiswebpage.max_length:min_length:do_sample:
early_stopping:
num_beams:
temperature:
top_k:
top_p:
repetition_penalty:
length_penalty:
no_repeat_ngram_size:
bad_words_ids:Modify All SettingsYou have the ability to modify all of the default text generation parameters at once as shown below.fromchattingtransformerimportChattingGPT2settings={"do_sample":False,"early_stopping":False,"num_beams":1,"temperature":1,"top_k":50,"top_p":1.0,"repetition_penalty":1,"length_penalty":1,"no_repeat_ngram_size":2,'bad_words_ids':None,}gpt2=ChattingGPT2("gpt2")text="I think therefore I "result=gpt2.generate_text(text,method="custom",custom_settings=settings)Modify LengthYou may modify the min and max length of the output using parameters within the generate_text method.fromchattingtransformerimportChattingGPT2gpt2=ChattingGPT2("gpt2")text="I think therefore I "result=gpt2.generate_text(text,min_length=5,max_length=500)
Package: chatting-with-pdfs
About Python Chat PDF (GPT Index) ProjectLoad your PDFs data folder and ask questions via llama_index and GPT.What is LlamaIndexLlamaIndex (GPT Index) is adata frameworkfor your LLM application.ContextLLMs are a phenomenonal piece of technology for knowledge generation and reasoning. They
are pre-trained on large amounts of publicly available data.The best approach to augment LLMs with our own private data, we need a comprehensive toolkit
to help perform this data augmentation for LLMs.Proposed SolutionThat’s where LlamaIndex comes in. LlamaIndex is a “data framework” to help you build LLM apps.
It provides the following tools:Offers data connectors to ingest your existing data sources and data formats (APIs, PDFs, docs, SQL, etc.)Provides ways to structure your data (indices, graphs) so that this data can be easily used with LLMs.Provides an advanced retrieval/query interface over your data: Feed in any LLM input prompt, get
back retrieved context and knowledge-augmented output.Allows easy integrations with your outer application framework (e.g. with LangChain, Flask, Docker,
ChatGPT, anything else).LlamaIndex provides tools for both beginner users and advanced users. Our high-level API allows
beginner users to use LlamaIndex to ingest and query their data in 5 lines of code. Our lower-level
APIs allow advanced users to customize and extend any module (data connectors, indices, retrievers,
query engines, reranking modules), to fit their needs.What does load_index_from_storage do and how does it work?load_index_from_storage is a function that loads an index from a
StorageContext object. It takes in a StorageContext object and an optional
index_id as parameters. If the index_id is not specified, it assumes there is
only one index in the index store and loads it. It then passes the index_ids
and any additional keyword arguments to the load_indices_from_storage
function. This function then retrieves the index structs from the index store
and creates a list of BaseGPTIndex objects. If the index_ids are specified, it
will only load the indices with the specified ids. Finally, the function
returns the list of BaseGPTIndex objects.Getting StartedInstructionsInstall the requirementspipinstall-rrequirements.txtGet a GPT API key fromOpenAIif you don't have one already.Run the script.python3chat_with_pdfs.py<"data_folder_path"><"open_api_key">Ask any questions about the content of the PDF.How to use our package:fromchat_pdf.chat_with_pdfsimportask_a_question
importsysfolder_name=sys.argv[1]api_key=sys.argv[2]print(ask_a_question(folder_name,api_key))
Package: chatto
ChattoA unified API wrapper for YouTube and Twitch chat bots.CPython versions 3.8 through 3.10 and PyPy version 3.8 are officially supported.Windows, MacOS, and Linux are all supported.InstallationTo install the latest stable version ofChatto:pipinstallchatto# If you need types:pipinstall"chatto[types]"To install the latest development version:pipinstallgit+https://github.com/parafoxia/chattoYou may need to prefix these commands with a call to the Python interpreter depending on your OS and Python configuration.SetupBefore you begin, you will need to have a Google Developers project with the YouTube Data API V3 enabled. You need an API key, and if you want to send and delete messages, you will need an OAuth client ID.Imade a videowalking through all the necessary steps.Creating a YouTube botTo create a simple YouTube bot, you could do something like this:importosfromchattoimportYouTubeBotfromchatto.eventsimportMessageCreatedEventbot=YouTubeBot(# Your project's API key.os.environ["API_KEY"],# The ID of the channel whose stream you want to connect to.os.environ["CHANNEL_ID"],# Your OAuth client ID secrets file.secrets_file="secrets.json",)# Listen for MessageCreatedEvents, and run this awaitable whenever a# new message is received.@bot.listen(MessageCreatedEvent)asyncdefon_message_created(event):# Ignore messages sent by the broadcaster.ifevent.message.channel.is_owner:return# Respond to messages starting with "!hello".ifevent.message.content.startswith("!hello"):awaitbot.send_message(f"Hi{event.message.channel.name}!")if__name__=="__main__":# This is blocking, so should be the last thing you call.bot.run()Chatto relies on the/searchendpoint to find a live broadcast from a channel, which is not 100% reliable. If you are having major issues getting Chatto to find your channel's live stream, you can pass the stream ID directly:bot.run(with_stream_id=os.environ["STREAM_ID"])If you don't want to use OAuth, you can launch Chatto in read-only mode. Note that your bot will not be able to send or delete messages in this mode:bot.run(read_only=True)To learn how to make more advanced bots, check thedocumentation.Creating a Twitch botTwitch bots are not yet supported.ContributingContributions are very much welcome! To get started:Familiarise yourself with thecode of conductHave a look at thecontributing guideLicenseTheChattomodule for Python is licensed under theBSD 3-Clause License.
Package: chattool
ChatAPI ToolkitEnglish|简体中文基于 API 的简单封装，支持多轮对话，代理，以及异步处理数据等。安装方法pipinstallchattool--upgrade使用方法设置密钥和代理链接通过环境变量设置密钥和代理，比如在~/.bashrc或者~/.zshrc中追加exportOPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"exportOPENAI_API_BASEL="https://api.example.com/v1"exportOPENAI_API_BASE_URL="https://api.example.com"# 可选Win 在系统中设置环境变量。示例示例1，模拟多轮对话：# 初次对话chat=Chat("Hello, GPT-3.5!")resp=chat.getresponse()# 继续对话chat.user("How are you?")next_resp=chat.getresponse()# 人为添加返回内容chat.user("What's your name?")chat.assistant("My name is GPT-3.5.")# 保存对话内容chat.save("chat.json",mode="w")# 默认为 "a"# 打印对话历史chat.print_log()示例2，批量处理数据（串行），并使用缓存文件checkpoint：# 编写处理函数defmsg2chat(msg):chat=Chat()chat.system("你是一个熟练的数字翻译家。")chat.user(f"请将该数字翻译为罗马数字：{msg}")# 注意，在函数内获取返回chat.getresponse()returnchatcheckpoint="chat.jsonl"# 缓存文件的名称msgs=["1","2","3","4","5","6","7","8","9"]# 处理部分数据chats=process_chats(msgs[:5],msg2chat,checkpoint)# 处理所有数据，从上一次处理的位置继续continue_chats=process_chats(msgs,msg2chat,checkpoint)示例3，批量处理数据（异步并行），用不同语言打印 hello，并使用两个协程：fromchattoolimportasync_chat_completion,load_chats,Chatlangs=["python","java","Julia","C++"]defdata2chat(msg):chat=Chat()chat.user("请用语言%s打印 hello world"%msg)# 注意，这里不需要 getresponse 而交给异步处理returnchatasync_chat_completion(langs,chkpoint="async_chat.jsonl",nproc=2,data2chat=data2chat)chats=load_chats("async_chat.jsonl")示例4，使用工具（自定义函数）：# 定义函数defadd(a:int,b:int)->int:"""This function adds two numbers.Parameters:a (int): The first number.b (int): The second number.Returns:int: The sum of the two numbers."""returna+b# 传输函数chat=Chat()chat.setfuncs([add])# 传入函数列表，可以是多个函数chat.user("请计算 1 + 2")# 自动调用工具chat.autoresponse(display=True)开源协议这个项目使用 MIT 协议开源。更新日志当前版本为2.3.0，支持调用外部工具，异步处理数据，以及模型微调功能。测试版本版本0.2.0改用Chat类型作为中心交互对象版本0.3.0开始不依赖模块openai.py，而是直接使用requests发送请求支持对每个Chat使用不同 API 密钥支持使用代理链接版本0.4.0开始，工具维护转至CubeNLP组织账号版本0.5.0开始，支持使用process_chats处理数据，借助msg2chat函数以及checkpoint文件版本0.6.0开始，支持function call功能版本1.0.0开始，支持异步处理数据版本2.0.0开始，模块更名为chattool
Package: chattr-req2toml
Req2TomlAdding the dependencies fromrequirements.txttopyproject.tomlandpoetry.lockwith one command 😉Install$pipinstallreq2tomlUsagesThe entrypoint of the converter isreq2lockOptions-f[required]  The  path to therequirements.txt--install[optional] By default, it will only update the lock, add this flag to install the dependencies at the same time.--dev[optional] By default, the flag is disable, pass--devto add packages to dev section.-v: Enable verbose mode to print out the debug logs# Only update the poetry.lock$req2lock-frequirements.txt# Install$req2lock-frequirements.txt--install# To dev$req2lock-frequirements_test.txt--install--devContributingPR is always welcome <3
Package: chattychattybangbang
chattychattybangbangdocsUtilities for using chatgpt more reliablyInstallpip install chattychattybangbangSet keyimport os
os.environ['OPEN_AI_KEY'] = 'getakeyfromopenaisite'ExampleAsks ChatGPT a question, then calls it again to QA the answer.from chattychattybangbang.castigateuntilvaluesare import castigate_until_values_are
question = """
  I would like you to pick three companies from the sp500 index. 
  Return a dictionary containing the main color in their logo (pick one only)
  The keys of the dictionary should be the company tickers. 
  Just provide the dict and nothing else in your response, please. 
"""
d = castigate_until_values_are(question=question, value_description='a color', max_retries=5)
print(d)

{'AAPL': 'white', 'MSFT': 'red', 'GOOGL': 'green'}Seeexamplesfor presidential poetry appreciation, etc.ArticleSeeReliably getting answers out of chatgpton medium. Thanks to Michael Rowe.One day certification courseJustkiddingbut check out ourawesome 10x prompting guide.
Package: chatty-debug
Chatty DebugInstallationBasic UsageFunction decoratorScript WrapperResponseAdvanced UsageResponseChatty ImprovementsBasic usage:ResponseChatty DebugUse ChatGPT to debug your python codeInstallationpip install -U chatty-debugNOTE: Requires OPENAI_API_KEY environment variableBasic UsageFunction decoratorfromchatty_debugimportchatty_debug@chatty_debug()# () is requireddeffoo():a=0b=10return100/a/bif__name__=="__main__":foo()Script Wrapper# foo.pydeffoo():a=0b=10return100/a/bif__name__=="__main__":foo()python -m chatty_debug foo.pyResponseAdvanced UsageYou may also specify a unique prompt. For example, you can request a
response in a different language, or provide more information about the
error that might not be available in the traceback.fromchatty_debugimportchatty_debug@chatty_debug(prompt="Me ajude a entender esse erro.")deffoo():a=0b=10return1000/b/aif__name__=="__main__":foo()Additionally, you can do the same with the script. Using the foo.py script
fromabove, you can also do this command:python -m chatty_debug foo.py --prompt "Me ajude a entender esse erro."ResponseChatty Improvementschatty-debug can also suggest improvements for your code.Basic usage:Without further configuration, the decorator will submit a default prompt
presenting your function. ChatGPT will then be asked to suggest
improvements to it. It will then be asked to suggest some tests to improve
it. These default prompts can be edited, removed, and added to.fromchatty_debugimportsuggest_improvements@suggest_improvements()# () is requireddeffoo(value,set=set()):list=list(set)forval1inlist:ifvalue==val1:returnTruereturnFalseif__name__=='__main__':foo()Response
Package: chatty-goose
Chatty GooseMulti-stage Conversational Passage Retrieval: An Approach to Fusing Term Importance Estimation and Neural Query RewritingInstallationMake sure Java 11+ andPython 3.7+are installedInstall thechatty-goosePyPI modulepip install chatty-gooseIf you are using T5 or BERT, make sure to installPyTorch 1.4.0 - 1.7.1using your specific platform instructions. Note that PyTorch 1.8 is currently incompatible due to thetransformersversion we currently use. Also make sure to install the correspondingtorchtextversion.Download the English model for spaCypython -m spacy download en_core_web_smQuickstart GuideThe following example shows how to initialize a searcher and build aConversationalQueryRewriteragent from scratch using HQE and T5 as first-stage retrievers, and a BERT reranker. To see a working example agent, seechatty_goose/agents/chat.py.First, load a searcherfrom pyserini.search import SimpleSearcher

# Option 1: load a prebuilt index
searcher = SimpleSearcher.from_prebuilt_index("INDEX_NAME_HERE")
# Option 2: load a local Lucene index
searcher = SimpleSearcher("PATH_TO_INDEX")

searcher.set_bm25(0.82, 0.68)Next, initialize one or more first-stage CQR retrieversfrom chatty_goose.cqr import Hqe, Ntr
from chatty_goose.settings import HqeSettings, NtrSettings

hqe = Hqe(searcher, HqeSettings())
ntr = Ntr(NtrSettings())Load a rerankerfrom chatty_goose.util import build_bert_reranker

reranker = build_bert_reranker()Create a newRetrievalPipelinefrom chatty_goose.pipeline import RetrievalPipeline

rp = RetrievalPipeline(searcher, [hqe, ntr], searcher_num_hits=50, reranker=reranker)And we're done! Simply callrp.retrieve(query)to retrieve passages, or callrp.reset_history()to reset the conversational history of the retrievers.Running ExperimentsClone the repo and all submodules (git submodule update --init --recursive)Clone and buildAnserinifor evaluation toolsInstall dependenciespip install -r requirements.txtFollow the instructions underdocs/cqr_experiments.mdto run experiments using HQE, T5, or fusion.Example AgentTo run an interactive conversational search agent with ParlAI, simply runchat.py. By default, we use the CAsT 2019 pre-built Pyserini index, but it is possible to specify other indexes using the--from_prebuiltflag. See the file for other possible arguments:python -m chatty_goose.agents.chatAlternatively, run the agent using ParlAI's command line interface:python -m parlai interactive --model chatty_goose.agents.chat:ChattyGooseAgentWe also provide instructions to deploy the agent to Facebook Messenger using ParlAI underexamples/messenger.
Package: chattymarkov
DescriptionChattymarkov is a python module that lets you generate random sentences
through a markov chain algorithm.It is useful mostly for bots which are aimed at learning from userâ€™s
chat and generate totally w.t.f. answers.The library can support multiple databases, especially redis which is
quite suitable to store relevant information for markov chains.InstallationpipinstallchattymarkovExamplesFromexamples/memory.py#!/usr/bin/env python3fromchattymarkovimportChattyMarkovmarkov=ChattyMarkov("memory://")markov.learn("My favorite animal is the crocodile")markov.learn("The word animal is six letters long")print(markov.generate())Here themarkovinstance learns two sentences (presumably gathered
from a chat network such as IRC or Discord). What is interesting is that
the â€˜animal isâ€™ sequence appears twice. So thegenerate()method,
which returns a completely random result, may return an entirely built
sentence which hasnâ€™t been ever written by anyone:$./memory.pyThewordanimalisthecrocodile$./memoryMyfavoriteanimalissixletterslongThe more sentences, the funnier generated ones.Supported databasesRedis(recommended): you can either provide a unix socket path (e.g.redis:///path/to/unix_socket.sock;db=0;password=foobaror an URL
(e.gredis://user:password@localhost:6739/0).
For the async version, either useredis_async://or instantiate aChattyMarkovAsyncinstance.JSON: you can provide a path to a file that will be formated with JSON.
Example:json:///path/to/file.jsonMemory: in-memory database, just providememory://as a connect
string. For the async version, usememory_async://instead.ContributeIf you want to add some support to a database or redesign the library,
please make a pull request so we can discuss about it.TodoSupport other databases?
Package: chattypy
Chatty.pyChatty.py is a library made in Python for making Chatty bots.ExampleFor a simple example, seeexample.py.
An even simpler example is shown bellow:importchattybot=chatty.Bot(name='example-bot',channel='hangout')@bot.on_readydefon_ready():print('Bot ready!')@bot.on_messagedefon_message(msg):print('User',msg.author,'sent message:',msg)@bot.on_commanddefon_command(cmd):print('User',cmd.author,'sent slash command:',cmd)ifcmd.cmd=='help':bot.send_msg(f'Help requested by @{cmd.author.name}')bot.run()
Package: chattyraspi-script
ChattyRaspi script allows you to run arbitrary code on your machine by
using Alexa interface.Installationpipinstallchattyraspi-scriptBasic examples$>chattyraspi-script\--config-filedevices_configuration.yaml\--on-cmd"systemctl start openvpn.service"\--off-cmd"systemctl stop openvpn.service"\--is-on-cmd"systemctl status openvpn.service"
Package: chatushka
Chatushka botБот для чатиков (пока только для телеграмушки)UsageInstallationpipinstallchatushkaStart botpython-mchatushka--token<telegrambotapitoken>Test botдобавить ботика в чатделегировать боту админские праванаписать в чатик /helppython-mchatushka--token<telegrambotapitoken>
Package: chat-webhooks
Chat WebhooksEasily interact and send messages with Google Chat's webhooks feature. This API is small, but should be a nice framework for working with any webhook.Installationpython-mpipinstall-Uchat_webhooksGetting Started# API Examplefromchat_webhooksimportChatWebhookchat=ChatWebhook("WEBHOOK_URL")chat.send("Hello, world!")# Shell example$python-mchat_webhooks-w"WEBHOOK_URL"# Interactive Google Chat webhook client# Made by BD103>Hello,world!More DocumentationYou can view a short guidehere.
Package: chatwizard
ChatWizardDiscord bot to encourage positiveness within a server by analyzing and scoring each member's behavior.OverviewChatWizard is a Discord bot that encourages positivity within a server by analyzing and scoring each member's behavior. It uses OpenAI's GPT-3.5-turbo to assess members based on factors such as helpfulness, language use, friendliness, and humor. With ChatWizard, you can create a more welcoming, engaging, and supportive environment for everyone in your server.FeaturesAnalyzes and scores server members based on grammar, friendliness, and humor values of their messages.Encourages and rewards positive contributions to the server.Provides a score breakdown so members can see how they're performing in each category.Logs all messages sent, making it easy to review member behavior.DemoDependenciesPython 3.6 or higherdiscord.pymodule (v1.7.3 or higher)openaimodule (v0.11.1 or higher)OpenAI API key (v4)A Discord user account and serverInstallationClone this repository:gitclonehttps://github.com/ulasonat/ChatWizard.gitInstall the required third-party packages:pipinstalldiscord
pipinstallopenaiSet up the following environment variables, replacingyour_discord_api_keyandyour_openai_api_keywith your actual API keys:For bash:exportDISCORD_API_KEY="your_discord_api_key"exportOPENAI_API_KEY="your_openai_api_key"For Windows cmd:set DISCORD_API_KEY="your_discord_api_key"
set OPENAI_API_KEY="your_openai_api_key"Invite the bot to your server through Discord Developer Portal.UsageTo run the application, execute the following command in your terminal/cmd prompt:pythonmain.py<openai_api_key><discord_api_key>Alternatively, you can import the library and call the main.run function by passing the Discord API key, OpenAI API key as arguments. Then, run the bot using therunmethod.run(discord_api_key,openai_api_key)Moreover, you can have instances of either OpenAIHandler or DiscordBot classes, and use the functions available.
If you want to use our library to get a humor score for the sentence, you can do the following:fromopenai_handlerimportOpenAIHandleropenai_handler=OpenAIHandler(api_key=open_ai_api_key,grammar_prompt_path=grammar_prompt_path,friendliness_prompt_path=friendliness_prompt_path,humor_prompt_path=humor_prompt_path,)worst_joke_ever='Why did the tomato turn red? Because it saw the salad dressing!'humor_score=openai_handler.get_humor_score(worst_joke_ever)More examples are included in our project's website.Bot CommandsTo get help:!helpTo view your scores:!meTo reset your scores:!resetAfter sending a message, ChatWizard will reply with an embed showing the score breakdown for that message.ContributingContributions are welcome! Please feel free to submit a pull request for any bug fixes or new features you would like to add.
Check theCONTRIBUTING.mdfor details!
Package: chatwolf
ChatwolfChatwolf is a small bot to play the popular Werewolf game in a group over a videochat.
Until now it only works on Skype, but maybe I will add other chat services.Rules of the gameHere you can find the basic rules of the werewolf game in german language:www.werwolfspielen.infoinstall the executable distribution (easiest way)download the latest distribution fromhereunzip the folder to where you want to have the program
It is standalone, so you do not need to install. To unistall simply delete the whole folder.do to the folder and run the "chatwolf.exe" fileinstall by sourceyou need Python3 installed.
If you haven't got it install it fromhereopen the terminal and install chatwolf from pypi with:pip install chatwolfYou can now use it ass a package.start the GUI or use the "start_manualy.py" script, which is in "chatwolf/scripts/".To start the GUI just enterchatwolfin the terminal.If this doesn't work, open python.exe and enter:importchatwolfroot=chatwolf.GUI()root.mainloop()Quickstart with GUI:you need one additional Skype account, wich will be the Game-master-Account.
Create one or just ask a friend whos not playing to give you his/her accountcreate a group in Skype with your friends and the Game-master-Account.log in with the Skype account of the Game-master-Account in the programselect the groupchat, the number of werewolfs and the roles you wantstart the game and play on Skype.
You will get all further commands over Skype from the Game-master-AccountTip:if you want to use another Videochat service for the Videocalls, you can do so.
Just use Skype to talk to the Game-master-Account.