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.1.0.tar.gz (6.0 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.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mixpeek-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 7ba26f196f5ccfbc27f9af9aa02a91ef994bd500e6f54ab242981bc6c3eea45f
MD5 6751acb4a408c4a9240eebdcf0486feb
BLAKE2b-256 6a4630b734405eb4179072600df0305f54e088baefb419b6bc9ca64eb13e0498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mixpeek-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 827cd1d8e7ff37fc589d9dde8379490752804360b0368f56060816cfead180ea
MD5 cf95cad06b26040e7696bfe614dbdd62
BLAKE2b-256 ba7ca9e655ff41c2517ea1ae2e438f09b3fcc2bd998994c9af526a1c6ac6de82

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