Skip to main content

Collection of tools and UIs for chatting and experimenting with multiple LLMs (via their APIs) at the same time.

Project description

🍋😛 SUMMONy aka S6

Collection of tools and UIs for chatting and experimenting with multiple LLMs (via their APIs) at the same time.

screenshot 0

Features

  • support for most top-tier and/or common LLM APIs:
    • OpenAI, Anthropic, Google Gemini, Ollama API, more to come
    • all under a common interface
    • (coming soon) supporting multimodal capabilities
  • parallel streaming and display of outputs - to be able to read the results as fast as possible
  • simple but powerful jupyter notebook code-first UI capable of:
    • re-asking the same question with different parameters
    • asking questions only to specific agents in a multi-agent conversation, aka tree-style/non-linear conversations
    • (to be improved) rendeing of LaTeX, html, code and diagrams in common formats in answers
  • simple but powerful conversations (de)serialization format, capturing both the messages and the parameters useed at their generation, and able to avoid storing duplicated copies of the same message in the histories of multiple agents part of the conversation
  • full api-calls logging (file based, structured - JSON): every request-response pair, every chunk in a stream response

Install

pip install summony summony[openai] summony[anthropic] summony[google] summony[ollama]

Usage / examples

Prerequisites

  • copy .env.example to .env (git ignored) and add in your API keys
  • either install summony package or clone this repo and follow instructions under "Develop / run-from cloned repo" heading

Jupyter Notebook UI

(See full example in ./example-1.v2.ipynb - rerun locally to see full ouputs as some parts are not rendered notebook previews)

c = NBUI(
    models=[
        "claude-3-5-sonnet",  # model name "shortcuts" for anthropic too (eg. instead of "claude-3-5-sonnet-20240620" etc.)
        "o1-preview",  # reasoning models supported under same interface
        "gemini-1.5-pro-002",
    ],
    system_prompt="You are the sum of most of humanity's knowledge crystallized into a single entity: a helpful and thoughtful AI.",
    p_temperature={0: 0.6, 2: 0.8},  # params targetted to agents by index, eg. 0.6 for sonnet, 0.8 for gemini
)
await c("What is entropy?")  # async default to suport simultaneous display of parallel streaming responses

screenshot 1

[...]

screenshot 2

# ask follow-up question only to first agent (sonnet)
await c("What about quantum entropy?", to=[0])

screenshot3

# re-generate answer for third agent (originally generated reply messagee is kept in conversation history too, but ignored for further request unless explicitly picked by setting its .chosen=True)
await c(to=[2])
# next question targetting *all* agents in conversation
await c("Make me a very concise table with contexts and equations for entropy")
# serializing conversation to JSON
from summony.agents.serialization import conversation_to_dict

conv_dict = conversation_to_dict(c.agents)
with open("./data/example-1-conv.json", "w") as f:
    f.write(json.dumps(conv_dict, indent=2, ensure_ascii=False))
print(json.dumps(conv_dict, indent=2, ensure_ascii=False))
# read store conversation and boot it up in an UI
from summony.agents.serialization import conversation_from_dict

with open("./data/example-1-conv.json", "r") as f:
    conv_dict = json.loads(f.read())
restored_agents = conversation_from_dict(conv_dict)
restored_agents
c2 = NBUI(agents=restored_c_agents)

# (re)display conversation from agents histories
c2.show_conversation(short=80)
# carry on a restored conversation as you'expect
await restored_c.ask("Display it as HTML instead")

Develop / run-from cloned repo

Using UV

NOTE: uv is an awesome alterative to Pipenv, Poetry etc.

# create and activate python virtual environment
uv venv
source ./.venv/bin/activate

# install dependencies as recorded in uv.lock
uv sync --locked --all-extras

# create jupyter kernel for environment
uv run ipython kernel install --user --name=s6-uv

# run jupyter
uv run --with jupyter jupyter lab

Using plain pip

# (optional, recommended) create and activate a Python 3.12+ environment
pip install -r ./requirements.txt
ipython kernel install --user --name=s6-uv  # create jupyter kernel for environment
jupyter notebook  # or: jupyter lab

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

summony-0.1.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

summony-0.1.1-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file summony-0.1.1.tar.gz.

File metadata

  • Download URL: summony-0.1.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for summony-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00cdd384c41fb8548d6deb35f593b3089e5b530513665bb2dabe37c72ca418f6
MD5 f380357ebc293fecc17516bc667e22e2
BLAKE2b-256 acb5e232df978b515e3d980cab310db285809a50dc15d61fdf149692cabbce68

See more details on using hashes here.

File details

Details for the file summony-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: summony-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for summony-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86dc932d176668d090e72d0ae9a216cef382f104cf3b03e262e24af3040054c9
MD5 1432a1eb0859ccd4df3b0e5a5570092a
BLAKE2b-256 4ef64f723ca7481546429ae6d33b491de5cc7ee16240c4346db179915a7c2e52

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