Skip to main content

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


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.5.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openrelik_ai_common-0.5.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file openrelik_ai_common-0.5.0.tar.gz.

File metadata

  • Download URL: openrelik_ai_common-0.5.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0

File hashes

Hashes for openrelik_ai_common-0.5.0.tar.gz
Algorithm Hash digest
SHA256 db4959178ed347df4c3dfe761ea88e9bd2d7315d3c1167517ab89132319bd7ac
MD5 9661bcf34961a376a5560a6e6088071a
BLAKE2b-256 bf05c92f2fdc0105482153f9416a02c2f29923fc733c9a07828cd8712c2dd2c5

See more details on using hashes here.

File details

Details for the file openrelik_ai_common-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openrelik_ai_common-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63b08ae4190da93d782a056a3ecddac16f4e380d9ed6c2d2715f1a783032c5d8
MD5 54ae09009835a962cb7c0a145bd3596d
BLAKE2b-256 ed11457ab7803d01087f59f5d21399a6a1139eeb7090106b17c1d875e7301391

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page