Skip to main content

An integration package connecting Moonshot AI and LangChain

Project description

langchain-moonshot

This package contains the LangChain integration with Moonshot AI.

Installation

pip install -U langchain-moonshot

Chat Models

ChatMoonshot exposes Moonshot AI's large language models through LangChain's BaseChatModel interface.

from langchain_moonshot import ChatMoonshot

model = ChatMoonshot(model="moonshot-v1-8k")
model.invoke("Hello!")

Tool calling

from pydantic import BaseModel, Field

class GetWeather(BaseModel):
    """Get the current weather in a given location"""

    location: str = Field(..., description="The city and state, e.g. San Francisco, CA")


model_with_tools = model.bind_tools([GetWeather])

Environment Variables

  • MOONSHOT_API_KEY — Moonshot API key (required)
  • MOONSHOT_API_BASE — Custom API base URL (optional, defaults to https://api.moonshot.cn/v1)

For more information see the Moonshot AI API documentation.

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

lc_moonshot-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

lc_moonshot-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lc_moonshot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 27f23c6a6bc5a99f7c64dca8340d9d8ca884a03d8e76f1478725d958818b9f33
MD5 72fca39f2f94ee98e063980d9009228d
BLAKE2b-256 7f307c1e908e4a12f710cb8fd01dbfea047bc0812e60da46e70949e5a3ae54e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lc_moonshot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for lc_moonshot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 659dce4dabaa2692ab02bb49db7896ccf9029be96b36552f1db859539f7063cb
MD5 6199f2dee01dc1c3d596d9eebf1f83aa
BLAKE2b-256 c8ceef325469997d01a1b102ee5834b9ef636388726855eac76276fd09f8e7c7

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