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.6.0.tar.gz (13.7 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.6.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openrelik_ai_common-0.6.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openrelik_ai_common-0.6.0.tar.gz
Algorithm Hash digest
SHA256 181f9008e6e6875b21f43bf6f706ab6383196308c55d819d45e4749f63430c0d
MD5 8f5fd056d797211f27a8d5a79fca2cdf
BLAKE2b-256 e17ef006eb586584f97b6338cd33f668bde16546bd83c79e7a965118163d89d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for openrelik_ai_common-0.6.0.tar.gz:

Publisher: publish-pypi.yml on openrelik/openrelik-ai-common

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for openrelik_ai_common-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b53e8d5235a3187255c0265f644623557de8c59d80c2dc2fb7bfd028d362cca
MD5 5aaa37fa641596891702ba80f59bfcfb
BLAKE2b-256 d35825b598d8f4e68c9d587aa9d9d2c2a6fee8b9e6add1f6f9d5736a51ba99a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for openrelik_ai_common-0.6.0-py3-none-any.whl:

Publisher: publish-pypi.yml on openrelik/openrelik-ai-common

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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