Skip to main content

Python client for CoreLLM SDK — LLM gateway running Ollama on Hugging Face Spaces

Project description


title: CoreLLM SDK emoji: 🧠 colorFrom: indigo colorTo: purple sdk: docker pinned: false

CoreLLM SDK

A fully-featured Python client and Hugging Face Space for running LLMs via Ollama — with native LangChain & LangGraph support.

corellm-sdk acts as an all-in-one unified model interface!

📦 Install from PyPI

# Minimal installation (just the client)
pip install corellm-sdk

# With LangChain support
pip install "corellm-sdk[langchain]"

# With LangChain + LangGraph support
pip install "corellm-sdk[all]"

🤖 Available Models

The following models are available on the server. Do not use any other model names.

  • "gemma4:e4b" - text, vision, tools, thinking, audio, context=128k
  • "devstral:24b" - text, tools, context=128k
  • "cogito:14b" - text, tools, thinking, context=128k
  • "ornith:9b" - Text, thinking, tools, context=256k
  • "lfm2.5-thinking:1.2b" - ultra fast, tools, thinking, context=32k
  • "qwen3-embedding:8b" - embedding
  • "robit/ornith-vision:9b" - vision, tools, thinking

🚀 Quickstart

The new CoreLLMChat class wraps everything into a single, cohesive, Langchain-compatible chat model that also handles normal chat generation, raw completion, and OpenAI compatibility.

from corellm_sdk import CoreLLMChat

# Initialize the engine
llm = CoreLLMChat(
    model="gemma4:e4b"
)

🧩 LangChain & LangGraph Support

Use it seamlessly with your existing LangChain workflows:

from langchain_core.messages import HumanMessage
from langchain_core.prompts import ChatPromptTemplate

# Direct usage
response = llm.invoke([HumanMessage(content="Hello!")])
print(response.content)

# With Chains
chain = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant."),
    ("human", "{question}"),
]) | llm

print(chain.invoke({"question": "What is Python?"}).content)

💬 OpenAI Compatibility (openai_chat)

Have existing code using OpenAI structures? Just use the OpenAI method out of the box!

messages = [
    {"role": "system", "content": "You are a witty assistant."},
    {"role": "user", "content": "Tell me a joke."}
]

# Calls the /v1/chat/completions endpoint just like OpenAI
response = llm.openai_chat(messages, temperature=0.7)
print(response)

🛠 Raw APIs (raw_chat & generate)

If you want simpler formats:

# Raw Prompt Completion
print(llm.generate("Explain quantum physics in 1 sentence."))

# Standard Dict Chat
messages = [{"role": "user", "content": "Who are you?"}]
print(llm.raw_chat(messages))

🔄 Dynamic Model Switching

Switch models on the fly! The backend dynamically handles memory constraints and load transitions.

# Switch to another allowed model on your server!
llm.switch("devstral:24b")

print(llm.generate("Hello from Devstral!"))

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

corellm_sdk-1.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

corellm_sdk-1.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file corellm_sdk-1.1.0.tar.gz.

File metadata

  • Download URL: corellm_sdk-1.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for corellm_sdk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9132be4e2be7bf8a1b9b29ceab7cd623dbe071488f366dc7958fb96a740b6547
MD5 f67bbeee6d3c915d073abe1de6067d21
BLAKE2b-256 c88aa9fbe703ba19542704eb0c1137e0aeceffdcf43800e6509bc028fffffa55

See more details on using hashes here.

File details

Details for the file corellm_sdk-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: corellm_sdk-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for corellm_sdk-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dac6418616bae9b039b668e9c525a330b4167b6a5c0d0637cb732be40af389f7
MD5 3891a09f16ff09f99cd00acae2e81427
BLAKE2b-256 200893fdd82d6abcfdc5292a18e37577a8c04d12934ea5efa53bc274339d5437

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