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.0.tar.gz (10.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.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mixpeek-0.2.0.tar.gz
  • Upload date:
  • Size: 10.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.0.tar.gz
Algorithm Hash digest
SHA256 bc24391cb7303df2f56063eefc53db56790c8c21ba5e272eda8598026b8240ed
MD5 ff7d23a274cd42ed07b439902bd7d10e
BLAKE2b-256 c05ee8259e4a73734ae83619cd93c97e453ed12ea79687d8eda25d130b82482f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mixpeek-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5793a772d25ea8b8d85a0e537e3d82a92841a2dfd2ec47d219d4100b54aecb55
MD5 27b67b27fcdb0b471e64588d9eae90e1
BLAKE2b-256 f8b8d5b31c8f8b65f7b973e9eb5ff94ee69923b5e50d552abdff87fe4c0c1fe6

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