Skip to main content

LangChain integration for Mixpeek — multimodal retriever and tool for AI agents

Project description

langchain-mixpeek

LangChain integration for Mixpeek — multimodal retriever and tool for searching video, image, audio, and document content from AI agents and RAG pipelines.

Install

pip install langchain-mixpeek

Quick start

Retriever (5 lines)

from langchain_mixpeek import MixpeekRetriever

retriever = MixpeekRetriever(
    api_key="mxp_...",
    retriever_id="ret_abc123",
    namespace="my-namespace",
)
docs = retriever.invoke("find the red cup")

Tool (5 lines)

from langchain_mixpeek import MixpeekTool

tool = MixpeekTool(
    api_key="mxp_...",
    retriever_id="ret_abc123",
    namespace="my-namespace",
)
result = tool.invoke("find the red cup")  # returns JSON string

Async retriever

from langchain_mixpeek import AsyncMixpeekRetriever

retriever = AsyncMixpeekRetriever(
    api_key="mxp_...",
    retriever_id="ret_abc123",
    namespace="my-namespace",
)
docs = await retriever.ainvoke("find the red cup")

Use in a chain

from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
from langchain_mixpeek import MixpeekRetriever

retriever = MixpeekRetriever(api_key="mxp_...", retriever_id="ret_...", namespace="ns")
llm = ChatOpenAI()

prompt = ChatPromptTemplate.from_template(
    "Answer using this context:\n{context}\n\nQuestion: {question}"
)

chain = (
    {"context": retriever, "question": lambda x: x}
    | prompt
    | llm
)
response = chain.invoke("what happens at 2 minutes?")

Use as an agent tool

from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_openai import ChatOpenAI
from langchain_mixpeek import MixpeekTool

tools = [MixpeekTool(api_key="mxp_...", retriever_id="ret_...", namespace="ns")]
agent = create_openai_tools_agent(ChatOpenAI(), tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
executor.invoke({"input": "What's in the video at the 2-minute mark?"})

Configuration

Parameter Type Default Description
api_key str required Mixpeek API key (mxp_...)
retriever_id str required Mixpeek retriever ID (ret_...)
namespace str required Mixpeek namespace to search
top_k int 10 / 5 Max results (retriever / tool)
content_field str "transcript_chunk" Metadata field used as page_content
filters dict None Attribute filters passed to the retriever

Full docs

docs.mixpeek.com/agent-integrations/langchain

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_mixpeek-0.3.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

langchain_mixpeek-0.3.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_mixpeek-0.3.0.tar.gz.

File metadata

  • Download URL: langchain_mixpeek-0.3.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for langchain_mixpeek-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b12a3a59e14d51a77bd2b2fb42273869fdd5093be84276e4e48bfec7f1fec95e
MD5 83f2982db7b461660d218aa9ee98e416
BLAKE2b-256 ee99f484aeefd663bac456ba72b9ecf43638a682bfacfcb0a91d397d50ed58d7

See more details on using hashes here.

File details

Details for the file langchain_mixpeek-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_mixpeek-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c9dd2118cbd3e0d59e6cf283ed32e58f55685074d6dd0ff25d9f9b5257a93db
MD5 cb48a07eb2ec6c916a7f10e6d0de81ab
BLAKE2b-256 79e248605cdf78e9eb3215b6c71436f3647949c262ccb28175a2f0f553eb4222

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