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.2.2.tar.gz (11.8 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.2.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mixpeek-0.2.2.tar.gz
  • Upload date:
  • Size: 11.8 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.2.2.tar.gz
Algorithm Hash digest
SHA256 19dded1c10409bc7dc72d6b7537f6191a229e31abf7b25a687fec83b0a8a9e55
MD5 45cb942a5ccf4bbbddedf214fb0b3b25
BLAKE2b-256 3945465cff8c5e84ab720acbf05d8938574d22d3f3b786964cc3252b9602da4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mixpeek-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f6ce35f1b48fb9688e98721a7394a634b906635656b7e2068d141d572ffc8ef
MD5 ef247dbd3f2d5021aa105cc5b9f0c7bc
BLAKE2b-256 6bc7e912adceb9e7cddc28c2a2401eaabc940c2f426ae9015af51917d6cc3dab

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