Skip to main content

No project description provided

Project description

Flow Prompt

Introduction

Lamoom is a dynamic, all-in-one library designed for managing and optimizing prompts and making tests based on the ideal answer for large language models (LLMs) in production and R&D. It facilitates dynamic data integration, latency and cost metrics visibility, and efficient load distribution across multiple AI models.

Features

  • CI/CD testing: Generates tests based on the context and ideal answer (usually written by the human).
  • Dynamic Prompt Development: Avoid budget exceptions with dynamic data.
  • Multi-Model Support: Seamlessly integrate with various LLMs like OpenAI, Anthropic, and more.
  • Real-Time Insights: Monitor interactions, request/response metrics in production.
  • Prompt Testing and Evolution: Quickly test and iterate on prompts using historical data.

Installation

Install Flow Prompt using pip:

pip install lamoom

Authentication

OpenAI Keys

# setting as os.env
os.setenv('OPENAI_API_KEY', 'your_key_here')
# or creating lamoom obj
Lamoom(openai_key="your_key", openai_org="your_org")

Azure Keys

Add Azure keys to accommodate multiple realms:

# setting as os.env
os.setenv('AZURE_KEYS', '{"name_realm":{"url": "https://baseurl.azure.com/","key": "secret"}}')

Model Agnostic:

Mix models easily, and districute the load across models. The system will automatically distribute your load based on the weights. We support:

  • Claude
  • Gemini
  • OpenAI (w/ Azure OpenAI models)
  • Nebius with (Llama, DeepSeek, Mistral, Mixtral, dolphin, Qwen and others)
from lamoom import LamoomModelProviders

def_behaviour = behaviour.AIModelsBehaviour(attempts=[
    AttemptToCall(provider='openai', model='gpt-4o', weight=100),
    AttemptToCall(provider='azure', realm='useast-1', deployment_id='gpt-4o' weight=100),
    AttemptToCall(provider='azure', realm='useast-2', deployment_id='gpt-4o' weight=100),
    AttemptToCall(provider=LamoomModelProviders.anthropic, model='claude-3-5-sonnet-20240620', weight=100
    ),
    AttemptToCall(provider=LamoomModelProviders.gemini, model='gemini-1.5-pro', weight=100
    ),
    AttemptToCall(provider=LamoomModelProviders.nebius, model='deepseek-ai/DeepSeek-R1', weight=100
    )
])

response_llm = client.call(agent.id, context, def_behaviour)

Lamoom Keys

Obtain an API token from Flow Prompt and add it:

# As an environment variable:
os.setenv('LAMOOM_API_TOKEN', 'your_token_here')
# Via code: 
Lamoom(api_token='your_api_token')

Add Behavious:

  • use OPENAI_BEHAVIOR
  • or add your own Behaviour, you can set max count of attempts, if you have different AI Models, if the first attempt will fail because of retryable error, the second will be called, based on the weights.
from lamoom import OPENAI_GPT4_0125_PREVIEW_BEHAVIOUR
behaviour = OPENAI_GPT4_0125_PREVIEW_BEHAVIOUR

or:

from lamoom import behaviour
behaviour = behaviour.AIModelsBehaviour(
    attempts=[
        AttemptToCall(provider='azure', realm='useast-1', deployment_id='gpt-4o' weight=100),
        AttemptToCall(provider='azure', realm='useast-2', deployment_id='gpt-4o' weight=100),
    ]
)

Usage Examples:

from lamoom import Lamoom, Prompt

# Initialize and configure Lamoom
client = Lamoom(openai_key='your_api_key', openai_org='your_org')

# Create a prompt
prompt = Prompt('greet_user')
prompt.add("You're {name}. Say Hello and ask what's their name.", role="system")

# Call AI model with Lamoom
context = {"name": "John Doe"}
# test_data -  optional parameter used for generating tests
response = client.call(prompt.id, context, behavior, test_data={
    'ideal_answer': "Hello, I'm John Doe. What's your name?", 
    'behavior_name': "gemini"
    }
)
print(response.content)
  • To review your created tests and score please go to https://cloud.lamoom.com/tests. You can update there Prompt and rerun tests for a published version, or saved version. If you will update and publish version online - library will automatically use the new updated version of the prompt. It's made for updating prompt without redeployment of the code, which is costly operation to do if it's required to update just prompt.

  • To review logs please proceed to https://cloud.lamoom.com/logs, there you can see metrics like latency, cost, tokens;

Best Security Practices

For production environments, it is recommended to store secrets securely and not directly in your codebase. Consider using a secret management service or encrypted environment variables.

Contributing

We welcome contributions! Please see our Contribution Guidelines for more information on how to get involved.

License

This project is licensed under the Apache2.0 License - see the LICENSE file for details.

Contact

For support or contributions, please contact us via GitHub Issues.

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

lamoom-0.1.33.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

lamoom-0.1.33-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file lamoom-0.1.33.tar.gz.

File metadata

  • Download URL: lamoom-0.1.33.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for lamoom-0.1.33.tar.gz
Algorithm Hash digest
SHA256 362d63bf1bfa75e86a568a0b2d9a3db98f513f8f576ba852efab08c8a3428f50
MD5 b1cb0cfb64d67b076af6bc823a55a613
BLAKE2b-256 b1cb744731ade308e8b2a4ad10a80cf5921a76c816d0118965a3df541cc44347

See more details on using hashes here.

File details

Details for the file lamoom-0.1.33-py3-none-any.whl.

File metadata

  • Download URL: lamoom-0.1.33-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.3.0

File hashes

Hashes for lamoom-0.1.33-py3-none-any.whl
Algorithm Hash digest
SHA256 f9db541151fbf2b8b0ba5e8d23e04a4dbf3b9f31679f11ba428e111a65d87093
MD5 bdb5296f7a355f6affbfd773710a1da0
BLAKE2b-256 babdaacc4967a6ba5e0b29e87f473824df4351e9d275d33d0f9d4c202715264b

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