A client library for LoLLMs generate endpoint
Project description
LoLLMs Client Library
LoLLMs Client is a Python library for interacting with the LoLLMs generate endpoint. This library simplifies the process of sending POST requests to the endpoint and handling responses.
Table of Contents
Installation
To install the LoLLMs Client library, use pip:
pip install lollms_client
Usage
Here's an example of how to use the LoLLMs Client library:
from lollms_client import send_post_request
response = send_post_request(host_address="http://localhost:9600", prompt="Your prompt here")
print(response)
API Reference
send_post_request
Sends a POST request to the specified LoLLMs generate endpoint.
send_post_request(
host_address: str,
prompt: str,
model_name: Optional[str] = None,
personality: int = -1,
n_predict: int = 1024,
stream: bool = False,
temperature: float = 0.1,
top_k: int = 50,
top_p: float = 0.95,
repeat_penalty: float = 0.8,
repeat_last_n: int = 40,
seed: Optional[int] = None,
n_threads: int = 8
)
Parameters
host_address
(str): The host address of the LoLLMs generate endpoint (e.g., 'http://localhost:9600').prompt
(str): The prompt to be sent to the LoLLMs generate endpoint.model_name
(Optional[str]): The name of the model to be used (default: None).personality
(int): The personality to be used (default: -1).n_predict
(int): The number of tokens to predict (default: 1024).stream
(bool): Whether to stream the response (default: False).temperature
(float): The temperature for sampling (default: 0.1).top_k
(int): The number of top choices for sampling (default: 50).top_p
(float): The cumulative probability for top-p sampling (default: 0.95).repeat_penalty
(float): The penalty for repeating previous tokens (default: 0.8).repeat_last_n
(int): The number of previous tokens to consider for repeat penalty (default: 40).seed
(Optional[int]): The seed for random number generation (default: None).n_threads
(int): The number of threads to use for token prediction (default: 8).
Returns
- If the request is successful, the function returns the response text.
- If the request fails, the function returns a dictionary with the status set to False and the error message in the response:
{"status": False, "error": str(ex)}
.
Contributing
Contributions are welcome! If you'd like to contribute to this project, please open a pull request with your proposed changes.
License
LoLLMs Client is released under the Apache 2.0 License.
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
lollms_client-0.0.1.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for lollms_client-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9bb26a119b7d74f0d85c05bc901785b277db551b2b873e71295533ac210b6fd |
|
MD5 | 01f3af626ca01537040a0ac06dd80032 |
|
BLAKE2b-256 | 2f85fa39be4114cf58e590f411c8bf3b86500d71f07a74c90d56f993bb0fa243 |