API Client for Ooba Booga's Text Generation WebUI
Project description
Python API Client for Ooba-Booga's Text Generation Web UI
An API client for the text generation UI, with sane defaults.
Motivation: documentation isn't great, examples are gnarly, not seeing an existing library.
Supported use cases:
- generate / instruct
- chat
- streaming instruct
- streaming chat
- model info
Example:
import logging
from ooba_api.clients import OobaApiClient
from ooba_api.parameters import Parameters
from ooba_api.prompts import LlamaInstructPrompt
logger = logging.getLogger("ooba_api")
logger.setLevel(logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)
client = OobaApiClient() # defaults to http://localhost:5000
response = client.instruct(
LlamaInstructPrompt(
system_prompt=(
"Generate only the requested code from the user. Do not generate anything else. "
"Be succint. Generate markdown of the code, and give the correct type. "
"If the code is python use ```python for the markdown. Do not explain afterwards"
),
prompt="Generate a Python function to reverse the contents of a file",
),
parameters=Parameters(temperature=0.2, repetition_penalty=0.7),
)
print(response)
```python
def reverse_file(file_path):
with open(file_path, "r") as f:
content = f.read()
return content[::-1]
```
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
Close
Hashes for ooba_api_client-0.1.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dc002d04e023869b1eb7bb4ecb2998ae018ed08f582a65b67a1645fa780b13f |
|
MD5 | 68af9be5a865a62ec1f1be352c0b409b |
|
BLAKE2b-256 | 96db108a798b499b8c7215869d613c89b3e46456610fda2a76b18b675f59ffaa |