A huggingchat python api.
Project description
hugging-chat-api
HuggingChat Python API
Leave a star :)
How to Use
Basic mode
pip install hugchat
from hugchat import hugchat
chatbot = hugchat.ChatBot()
print(chatbot.chat("HI"))
# Create a new conversation
id = chatbot.new_conversation()
chatbot.change_conversation(id)
# Get conversation list
conversation_list = chatbot.get_conversation_list()
The chat()
function can receive many parameters:
text
: Required[str].temperature
: Optional[float]. Default is 0.9top_p
: Optional[float]. Default is 0.95repetition_penalty
: Optional[float]. Default is 1.2top_k
: Optional[int]. Default is 50truncate
: Optional[int]. Default is 1024watermark
: Optional[bool]. Default is Falsemax_new_tokens
: Optional[int]. Default is 1024stop
: Optional[list]. Default is [""]return_full_text
: Optional[bool]. Default is Falsestream
: Optional[bool]. Default is Trueuse_cache
: Optional[bool]. Default is Falseis_retry
: Optional[bool]. Default is Falseretry_count
: Optional[int]. Number of retries for requesting huggingchat. Default is 5
CLI mode
version 0.0.5.1
or newer
You can use cli mode
to test the repo:
from hugchat import hugchat
hugchat.cli()
Commands in cli mode:
/new
: Create and switch to a new conversation./ids
: Shows a list of all ID numbers and ID strings in current session./switch <id>
: Switches to the ID number passed./exit
: Closes CLI environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hugchat-0.0.5.2.tar.gz
(16.2 kB
view hashes)
Built Distribution
hugchat-0.0.5.2-py3-none-any.whl
(16.6 kB
view hashes)
Close
Hashes for hugchat-0.0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a06d3f9d9f9b3365f4940af3b6a6015af8e54e7c3e119b0cf975cff195f1382e |
|
MD5 | ae5b18d863076f1f0bbaff0d5403f657 |
|
BLAKE2b-256 | bf3a2923f6b5ee626cb76aca4fcce2ca1e4f7f841b38ba0523feea1ffaac16a5 |