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.2.tar.gz (8.6 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.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mixpeek-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 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.2.tar.gz
Algorithm Hash digest
SHA256 1633b5bc71df49c5849d9cbd06f453d3580ec752279586601e547f4b4e08c881
MD5 2fea9a2a16d8f0356afa4b6a2d009010
BLAKE2b-256 7462b53e1a2752a10dbd1e3ad2e1273036f2037836635de45269bcb3d2578cb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mixpeek-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 366e44aae12f5484c6eb16dc3e838d99a1962d49321b63d68a6e1863e8566492
MD5 751063e020c56e33e5ce49fce943348e
BLAKE2b-256 a9f7b72c682ccad2c79476c9f7136b7f9b003970358488a112ee1d8cfbb759ae

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