Skip to main content

A simple framework to interact with conversational LLMs

Project description

PyPI - Downloads GitHub GitHub issues Discord Twitter Follow

Lobsang

Welcome to Lobsang 🧘‍♂️

Lobsang is a framework to interact with conversational LLMs in the simplest way possible.
It's easy to get started, yet designed to scale up to complex use cases. Enjoy the ride! 🚀

Note: This project is still in early development. Expect breaking changes.

Installation

Requires Python 3.11 or higher.

pip install lobsang

Core Concepts

Lobsang is built around a few core concepts:

  • Chat: The main class is the Chat class. It represents a conversation between a user and a LLM. It is the main entry point to the framework and stores the chat history for a single conversation. After creating a Chat instance, you can interact with it by calling itself with one or more messages:
    from lobsang import Chat
    from lobsang.llms import FakeLLM
    chat = Chat(llm=FakeLLM()) 
    #                 👆 FakeLLM returns dummy responses
    # Call the chat with one message
    chat("Hello!")
    chat("How are you?")
    print("Chat history:")  
    print(chat)
    
    # Call the chat with multiple messages
    res = chat("What is 1+1?", "What is 2+2?")
    print("Chat Snippet:")
    print(res)
    print("Full chat history:")
    print(chat)
    
    • Directives: Directives are used to guide the LLM to generate a specific response by embedding instructions in a corresponding message. For example, you can use the JSON directive to instruct the LLM to generate a JSON response (see examples/utilize_directives.py for more details).

Examples

We provide a few examples to get you started. You can find them in the examples folder. The examples use the openai package, make sure to install it before running the examples (pip install openai). You will also need an OpenAI API key, which you can get here: https://platform.openai.com/account/api-keys.

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

lobsang-0.0.3.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

lobsang-0.0.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file lobsang-0.0.3.tar.gz.

File metadata

  • Download URL: lobsang-0.0.3.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for lobsang-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ebfd0ad11d9ea2f676a405b2980eb03e1847adfa5d4b72e165a07e5b982a8eda
MD5 a51aab5bb7ca4a15acb5eb89cdc20140
BLAKE2b-256 156239191e2bdce6a7b6551ffc55e3ff628b3f7f88970c4adae05f0a09a0812d

See more details on using hashes here.

File details

Details for the file lobsang-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: lobsang-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for lobsang-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1b7802c184e84b6b520bf5691323725bb17b8224dae519439381dc8e4d122239
MD5 f4ad0326ee2d2f4901ef137018a06e12
BLAKE2b-256 f1d7beaa1bd4f567351b7e8f49aa8cd53e38ab57560127d79d6a1bb00be802c2

See more details on using hashes here.

Supported by

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