A Python library for interacting with the VersaCore LLM Chat API.
Project description
VersaCoreLLMChatAPI
A Python library for interacting with VersaCore LLM Chat API.
Installation
pip install versacorellmchatapi
Usage
if __name__ == "__main__":
def handle_chunk(chunk, end=False):
# Custom handling of each chunk
if chunk:
print(chunk, end='', flush=True)
if end:
print() # Print a newline at the end of the stream
lm_studio_llm_api = VersaCoreLLMChatAPI("lmstudio")
ollama_llm_api = VersaCoreLLMChatAPI("ollama")
messages = [
{ "role": "system", "content": "You are a useful chatbot." },
{ "role": "user", "content": "write a short story of 2000 words about a funny corgi." }
]
lm_studio_response = lm_studio_llm_api.chat_completions(
messages,
model="lmstudio-community/Mistral-7B-Instruct-v0.3-GGUF/Mistral-7B-Instruct-v0.3-Q5_K_M.gguf",
temperature=0.7,
max_tokens=-1,
stream=True,
callback=handle_chunk
)
ollama_response = ollama_llm_api.chat_completions(
messages,
model="mistral",
stream=True,
callback=handle_chunk # Use the custom callback to handle streaming chunks
)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file versacorellmchatapi-0.1.9.tar.gz.
File metadata
- Download URL: versacorellmchatapi-0.1.9.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66407caf2c7f31040ef61ff147596b87c575c4f28bd5d4b56b0ab3ee5c49ceb9
|
|
| MD5 |
16f1859ee0a8a681f162b931c39777ea
|
|
| BLAKE2b-256 |
08c43055756465ec9a6a31287bd5d3bc3ca02cd6daefa459840fbcbe17482ab2
|
File details
Details for the file versacorellmchatapi-0.1.9-py3-none-any.whl.
File metadata
- Download URL: versacorellmchatapi-0.1.9-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d0a78f6f0d3b583b26a2d7a3e936d82af866b5bf6b867526780ebcf49ab7e86
|
|
| MD5 |
f53897f36af0d574bb13acca627a61e0
|
|
| BLAKE2b-256 |
d6ed6faff111bf9af0b36bf1e8863c74c6916f13667ca889c48f804f286e006b
|