Skip to main content

An LLM wrapper built for scene prog projects

Project description

SceneProgLLM

SceneProgLLM is a powerful and versatile Python package that wraps around LangChain's LLM interface to provide enhanced functionality, including support for text, code, and JSON response formats, image input/output, caching, and multiple endpoints. This project is built to support SceneProg projects.


Features

  1. Flexible Response Formats:
    • Supports text, code, JSON, and image outputs.
  2. Image Input and Output:
    • Accepts image inputs and enables image generation through Stable Diffusion (SD) or OpenAI's image generation API.
  3. Caching:
    • Integrated caching system to store and retrieve previous query responses for faster execution.
  4. Strict JSON Validation:
    • Ensures correct JSON structure, particularly when specific keys are required.

Installation

To install the package and its dependencies, use the following command:

pip install sceneprogllm

Getting Started

Importing the Package

from sceneprogllm import LLM

Usage Examples

  1. Generating Text Responses
llm = LLM(name="text_bot", response_format="text")
response = llm.run("What is the capital of France?")
print(response)
  1. Generating JSON Responses
llm = LLM(
    name="json_bot",
    response_format="json",
    json_keys=["capital", "currency"]
)
query = "What is capital and currency of India?"
response = llm.run(query)
print(response)
  1. Generating Python Code
llm = LLM(name="code_bot", response_format="code")
query = "Write a Python function to calculate factorial of a number."
response = llm.run(query)
print(response)
  1. Generating images from text
llm = LLM(name="image_bot", response_format="image")
response = llm.run("Generate an image of a futuristic cityscape.")
response.save("futuristic_city.jpg")
  1. Query using Images
llm = LLM(name="image_bot", response_format="text", num_images=1, image_generator="SD")
image_paths = ["path/to/input_image.jpg"]
response = llm.run("What is the color of the object in the image?", image_paths=image_paths)
  1. Clear LLM cache
from sceneprogllm import clear_llm_cache
clear_llm_cache()
```# sceneprogllm

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

sceneprogllm-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

sceneprogllm-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file sceneprogllm-0.1.0.tar.gz.

File metadata

  • Download URL: sceneprogllm-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for sceneprogllm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a03a824d2d1c9e137a71b9f0b78afaafb74fbdbc542ec95e1c008fc185fc4462
MD5 36d1f1ebb9e84fc925c67311a4690a48
BLAKE2b-256 54b339c24f3df22c50ced2cd9595a2ea85779e39108cf635fc20c15340a6288a

See more details on using hashes here.

File details

Details for the file sceneprogllm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sceneprogllm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for sceneprogllm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f090f629c0fa7c809f57c63b09913ee7014b7351dcd3cf5c21bc4aad7f2115b
MD5 c92db4c705b97208261f345195706f98
BLAKE2b-256 6b258310c5d1fd1b2cad77f503cda9ead154e30ad94fc114485c000c6f0d73d3

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