Skip to main content

A Django app for integrating LangChain with search capabilities

Project description

Overview

This project uses langchain (currently only OpenAPI) to search a Django model. Simply use LangChainSearchMixin in your view, and let the user perform a query with the ?q= parameter. Example:

http://127.0.0.1:8000/api/jobs/?q=Engineer jobs posted after or on June 22 2025 salary minimum 40000 hybrid

The human language query will be converted to your model fields using LangChain and ChatGPT.

Installation

This project runs with uv.

pip install uv
uv sync --frozen

To add to your django project Add this to apps: 'langchain_search'

You need to also set your openapi key

export OPENAI_API_KEY=....

Usage example

from .models import Job
from rest_framework import generics
from .serializers import JobSerializer
from langchain_search import LangChainSearchMixin

# Add mixin here
class JobListAPI(LangChainSearchMixin, generics.ListAPIView):
    queryset = Job.objects.all()
    serializer_class = JobSerializer

    def get(self, request, *args, **kwargs):
        return super().get(request, *args, **kwargs)

Example project: https://github.com/errietta/django-langchain-search-example

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_search_django-0.6.0.tar.gz (4.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_search_django-0.6.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_search_django-0.6.0.tar.gz.

File metadata

File hashes

Hashes for langchain_search_django-0.6.0.tar.gz
Algorithm Hash digest
SHA256 35de90be61da07716c789601681fc92c08f3aa21aac0e5df086cdc53f96dd8f2
MD5 88009819450dd9786712cba4e2e491ce
BLAKE2b-256 11f77ed70221562ce22144d8bf65931ab81051b1e999debf635f3cb6b60be1cd

See more details on using hashes here.

File details

Details for the file langchain_search_django-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_search_django-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1338efb7a70890f6ae5a2624b402ee44641e509bfa3e4451c0ae1e6e1bf21d6e
MD5 deeae88641bf3b60d221200989d853ad
BLAKE2b-256 fde7d8911fba63a96c2a7ac58acfec317cbf823c6567bc1ce6cb8e3b084f7545

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