Skip to main content

A unified interface for interacting with AI

Project description

The Great Completo

Completo provides a unified interface for interacting with LLMs.

Work in progress

Completo is currently in active development. Current features include:

  • Synchronous and asynchronous interfaces
  • Switch engines mid-conversation
  • Streaming responses
  • Pydantic models
  • Tool use
  • Model Context Protocol servers for tools
  • Instructor integration
  • Backend support:
    • OpenAI
    • Anthropic
    • Gemini
    • Ollama

Installation

Use the completo package.

Currently targeting Python 3.13 only.

Usage

Simple interface

from completo import Completo

llm = Completo(default_engine=SyncOpenAIEngine(), default_model="o3-mini")

response = str(llm.complete("Hello, world!"))  # => "Hey, how can I help you today?"

Conversational interface

from completo import Completo, Conversation, UserMessage, DeveloperMessage, AssistantMessage

llm = Completo(default_engine=SyncOpenAIEngine(), default_model="o3-mini")

convo = Conversation()
convo.messages.append(DeveloperMessage(content="Respond in a single word"))  # Short-hand text content
convo.messages.append(UserMessage(content=[TextContent(text="What is the capital of France?")]))  # Fully-formed content

response = llm.complete(convo)

assert response.content[0].text == str(response) == "Paris"
assert isinstance(convo.messages[0], DeveloperMessage)
assert isinstance(convo.messages[1], UserMessage)
assert isinstance(convo.messages[2], AssistantMessage)

Async interfaces

from completo import AsyncCompleto

llm = AsyncCompleto(default_engine=AsyncAnthropicEngine(), default_model="claude-3-5-sonnet-latest")

response = await llm.complete("Hello, world!")

Streaming

from completo import Completo
from completo.models.completions import CompletionDelta

llm = Completo(default_engine=SyncOpenAIEngine(), default_model="o3-mini")

response = llm.complete("Hello, world!")

for completion in response.stream():
    assert isinstance(completion, CompletionDelta)
    print(completion.content[0].text)
    # => "Hey"
    # => ", "
    # => "how"
    # => " can I"
    # => "help"
    # => " you"
    # => "today?"

Async streaming

from completo import AsyncCompleto

llm = AsyncCompleto(default_engine=AsyncOpenAIEngine(), default_model="o3-mini")

response = await llm.complete("Hello, world!")

for completion in response.stream():
    assert isinstance(completion, CompletionDelta)
    print(completion.content[0].text)
    # => "Hey"
    # => ", "
    # => "how"
    # => " can I"
    # => "help"
    # => " you"
    # => "today?"

Switching engines

from completo import Completo

openai = SyncOpenAIEngine()
anthropic = SyncAnthropicEngine()

llm = Completo(default_engine=openai, default_model="o3-mini")

response = llm.complete("Which model are you executing on?")
print(response.content[0].text)  # => "o3-mini"

response = llm.complete("Which model are you executing on?", engine=anthropic, model="claude-3-5-sonnet-latest")
print(response.content[0].text)  # => "claude-3-5-sonnet-latest"

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

completo-0.0.7.tar.gz (138.5 kB view details)

Uploaded Source

Built Distribution

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

completo-0.0.7-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file completo-0.0.7.tar.gz.

File metadata

  • Download URL: completo-0.0.7.tar.gz
  • Upload date:
  • Size: 138.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for completo-0.0.7.tar.gz
Algorithm Hash digest
SHA256 a65859f12197b3c3738528e243a1331401ac1217ec462fd68bccefdbab7c1855
MD5 9b9d62158023c8d2d706d802c3717560
BLAKE2b-256 e1fe7e0e42d4d2fc191dc387f32bc53be7294d2c9ea0d2b6bbd1676d0aa7f8ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for completo-0.0.7.tar.gz:

Publisher: release.yml on rmasters/completo

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

File details

Details for the file completo-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: completo-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for completo-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7a925ebb50111608f2ce96bb0a1a6a5b0d06bfffe5080c50086824ab08c5465f
MD5 6d8c40cc90ce1178e9d4dce1c267fc87
BLAKE2b-256 db7930bf59b44068c49a2d795b7e9bd2f81400ed6a1308cf6343514af7d51798

See more details on using hashes here.

Provenance

The following attestation bundles were made for completo-0.0.7-py3-none-any.whl:

Publisher: release.yml on rmasters/completo

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