Common utilities for OpenRelik AI functionality
Project description
Common utilities for OpenRelik AI functionality.
# LLM providers are configured via environment variables
# export OLLAMA_SERVER_URL=http://localhost:11434
# export OLLAMA_DEFAULT_MODEL=gemma2:9b
from openrelik_ai_common.providers import manager
provider = manager.LLMManager().get_provider("ollama")
llm = provider(model_name="gemma2:9b", system_instructions="Your name is Foobar.")
# Single text generation
response = llm.generate(prompt="Hello, what is your name?")
print(response)
# Multiturn chat session
response = llm.chat("What is your name?")
print(response)
response = llm.chat("My name is John Doe")
print(response)
response = llm.chat("What is my name?")
print(response)
# Chat on the command line
while True:
message = input("Message: ")
response = llm.chat(message)
print(response)
Obligatory Fine Print
This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.
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
openrelik_ai_common-0.4.0.tar.gz
(13.3 kB
view details)
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 openrelik_ai_common-0.4.0.tar.gz.
File metadata
- Download URL: openrelik_ai_common-0.4.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.1 CPython/3.12.7 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ee74b6bd3d40ee76d45c9d0f70dc12741705d763dcfe390c334c08377db0fd4
|
|
| MD5 |
624e727fa7972e11e1ac7f9a83610b14
|
|
| BLAKE2b-256 |
2e8ea7d48c4f297ae73f56d86c0f6f33be1eaebbe467c5ddc95b44c07bc80aaa
|
File details
Details for the file openrelik_ai_common-0.4.0-py3-none-any.whl.
File metadata
- Download URL: openrelik_ai_common-0.4.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.1 CPython/3.12.7 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef0b31c1b2ad7412d300c9afbae83da5fd9d17bbc239b2ede44c235bd054a15
|
|
| MD5 |
95f96843ca45b8b9588b1a90566bdc3d
|
|
| BLAKE2b-256 |
69f223e027d5f9d101af2c75a083ea1500e7a7e0d2fa1687d3e8469c33faf207
|