Skip to content

lukeedIII/hugging-chat-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hugging-chat-api

HuggingChat Python API

PyPi Support_Platform Downloads

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.9
  • top_p: Optional[float]. Default is 0.95
  • repetition_penalty: Optional[float]. Default is 1.2
  • top_k: Optional[int]. Default is 50
  • truncate: Optional[int]. Default is 1024
  • watermark: Optional[bool]. Default is False
  • max_new_tokens: Optional[int]. Default is 1024
  • stop: Optional[list]. Default is [""]
  • return_full_text: Optional[bool]. Default is False
  • stream: Optional[bool]. Default is True
  • use_cache: Optional[bool]. Default is False
  • is_retry: Optional[bool]. Default is False
  • retry_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.

About

HuggingChat Python API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%