Skip to main content

LangChain provider for Common Compute — plug Apple-Silicon-powered LLMs and embeddings into your LangChain app.

Project description

langchain-commoncompute

LangChain provider for Common Compute.

pip install langchain-commoncompute
from langchain_commoncompute import CommonComputeChat, CommonComputeEmbeddings
from langchain_core.prompts import ChatPromptTemplate

llm = CommonComputeChat(model="qwen-2.5-7b")
emb = CommonComputeEmbeddings(model="bge-small")

prompt = ChatPromptTemplate.from_messages([("user", "Summarize: {doc}")])
chain = prompt | llm
print(chain.invoke({"doc": "Common Compute runs AI on idle Macs."}).content)

Streaming is supported natively:

for chunk in llm.stream("Write a haiku about Apple Silicon."):
    print(chunk.content, end="", flush=True)

Set CC_API_KEY in your environment (or pass api_key=... to either class).

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

langchain_commoncompute-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

langchain_commoncompute-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_commoncompute-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for langchain_commoncompute-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9bb226495dd3a567da0437338b15dbdfc412e6f000c7c94cb8933b9e5d62b312
MD5 fd8e89cbec9d97719639bfdd7a6745a1
BLAKE2b-256 4f85cea30cb189d218b5c4047075008ca1d9730628747138f9a3c43488ca65a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_commoncompute-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3be0fc969d824b79c7c7e91b5ec355bcc6e4e7d2e9c6eac35c04f479803e597d
MD5 62281943cc2c36ebb19d3a880c65ad69
BLAKE2b-256 b794b4e87231004f800d00dd5e270b4e8943919bd2e1449d40e15e2c722eb642

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