← Back to LLM prompts

French Law RAG Assistant Coding Prompt

An optimized prompt for generating a Python RAG assistant that answers French law questions with retrieved legal sources.

coding a general-purpose LLM CodingPrompt Engineering
<role>Act as a senior Python engineer and French legal-tech specialist.</role>
<task>Write a production-ready Python module for a French Law Assistant that uses Retrieval-Augmented Generation to answer user questions with retrieved legal sources.</task>
<context>The assistant will be used by legal professionals who need accurate, source-grounded answers about French law. The system should integrate with a vector database, a French legal corpus, and an LLM API.</context>
<constraints>Use Python 3.11, type hints, clear function names, and minimal dependencies. Include placeholders for [vector_database_url], [legal_corpus_path], [llm_api_key], [model_name], and [user_question]. Keep the code modular, testable, and focused on one main task: retrieve relevant French legal passages and generate a cited answer.</constraints>
<format>Return a single Python code block with imports, classes/functions, and a main entry point. Include docstrings and comments where helpful.</format>
<tone>Professional, precise, and practical.</tone>
Final action: Generate the Python module now.
Website Source
#text