Personal Prompts for LangChain

Open in ColabOpen in GitHub

Overview

This cookbook contains a comprehensive collection of specialized prompts designed for various professional domains using LangChain. The prompts are crafted to leverage the power of large language models while maintaining domain expertise and professional standards.

The primary goals of this project are to:

  • Provide standardized, high-quality prompts for different professional domains

  • Enable consistent and reliable outputs from language models

  • Facilitate domain-specific knowledge extraction and analysis

  • Support automated report generation and content creation

  • Maintain professional standards across various fields

Table of Contents

References


Environment Setup

Set up the environment. You may refer to Environment Setup for more details.

[Note]

  • langchain-opentutorial is a package that provides a set of easy-to-use environment setup, useful functions and utilities for tutorials.

  • You can checkout the langchain-opentutorial for more details.

Prompt Generating Tips

Model Comparison at a Glance:

Feature

ChatGPT

Claude

Gemini

Strengths

Conversational, logical reasoning

Handles structured formats, logical responses

Works well with detailed tasks and examples

Best Practice

Clear, focused prompts

XML-style structured prompts

Detailed instructions and examples

Example Use Case

Writing emails, casual conversations

Analytical tasks, structured outputs

Summaries, detailed reports, multimodal tasks

By following these tailored tips, you can maximize the strengths of each model and achieve optimal performance in your LangChain projects.

1. ChatGPT (OpenAI's GPT-4)

ChatGPT is a powerful language model known for its conversational ability and logical reasoning.

Prompt Tips:

  • Keep it Clear and Focused: Clearly define what you want the model to do. Don’t overload it with too much background information.

  • Ask for a Specific Format: If you need the response in bullet points, tables, or paragraphs, mention it.

  • Assign a Role: Tell ChatGPT who it is (e.g., "You are a project manager") to get more tailored answers.

2. Claude (Anthropic's Model)

Claude excels in structured thinking and understanding detailed tasks. It often works well with XML-style formatting for prompts.

Prompt Tips:

  • Use Structured Formats: Use XML tags to organize the instructions, which helps Claude interpret them better.

  • Provide Context and Examples: Add a clear task and examples to guide the model's response.

3. Gemini (Google’s AI Model)

Gemini is a cutting-edge multimodal AI designed to work across text, images, and other data types. It handles detailed and structured tasks effectively.

Prompt Tips:

  • Be Detailed and Specific: Clearly explain the task and provide any necessary background details.

  • Break Complex Tasks into Steps: If the task is complicated, split it into smaller, sequential steps.

  • Add Examples: Providing examples helps Gemini align its output with your expectations.


Basic Prompts

The Basic Prompts chapter covers summarization tasks that are most commonly used across all domains. These prompts can be used individually or combined in a pipeline:

  1. Sequential Processing

  2. Parallel Processing

  3. Hybrid Processing

1. Summary Prompt

The Summary Prompt is designed to create concise, informative summaries of documents while maintaining key information and context.

You can find the uploaded prompt in your LangSmith. Please go to the site address as output.

2. Map Prompt

The Map Prompt is used to extract and organize main themes from documents, creating a structured representation of the content.

3. Reduce Prompt

The Reduce Prompt combines and synthesizes multiple summaries into a single, coherent output, particularly useful for processing large document sets.


Advanced Prompts

The Advanced Prompts chapter explores sophisticated techniques that enhance the quality and specificity of language model outputs. These prompts are designed to handle complex tasks requiring deeper analysis and more nuanced responses.

1. Chain of Density Summarization

Chain of Density Summarization iteratively refines summaries to achieve higher information density while maintaining readability and key insights.

1.1. Chain of Density (Multilingual)

Generate increasingly dense summaries in any specified language through iterative refinement while maintaining semantic accuracy.

1.2. Chain of Density Map (Multilingual)

Create mapped summaries with increasing density in any specified language, focusing on key entity extraction and relationship mapping.

2. Key Information Extraction

Extract and structure critical information from various document types with high precision and consistency.

3. Metadata Tagging

Automatically generate relevant tags and metadata to enhance content organization and searchability.


Specialized Prompts

1. RAG Prompts

1.1. RAG Document Analysis

Process and answer questions based on retrieved document contexts with high accuracy and relevance.

1.2. RAG with Source Attribution

Enhanced RAG implementation with detailed source tracking and citation for improved accountability and verification.

2. LLM Response Evaluation

Comprehensive evaluation of LLM responses based on multiple quality metrics with detailed scoring methodology.


Professional Domain Prompts

Each professional domain prompt is carefully crafted to address specific industry needs and requirements.

This part requires optimization of prompts, especially according to domain data and format. Therefore, it is recommended that you test multiple prompts with Playground on websites such as OpenAI or Anthropic and use the most appropriate prompts. Below is an example of prompts in each field.

1. Academic Research Analysis Prompt

2. Clinical Case Analysis Prompt

3. Market Research Analysis Prompt

4. Educational Content Development Prompt

6. UX Research Analysis Prompt

7. Environmental Impact Assessment Prompt

Last updated