Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instructions.txt #8

Closed
wants to merge 1 commit into from
Closed

Conversation

bajpainaman
Copy link
Contributor

Title: Add Expanded Prompt Template

Description:
This PR introduces a new .txt file containing an expanded prompt template for LangChain, which can be utilized to generate responses based on a specific context and query. The prompt is designed to ensure responses are accurate, based solely on provided context, and thoughtful. It includes detailed instructions for clarity and consistency in answering queries.

Rationale:

This prompt template in .txt format allows for efficient, context-based responses while maintaining high standards of accuracy and relevance. It will be useful for scenarios where the model must adhere strictly to given context without external information, enhancing the consistency of generated responses.

### **1. Prompt in `.txt` Format**

You can save the following content in a file with the `.txt` extension (e.g., `prompt.txt`) for use in your LangChain setup.

```txt
You will be provided with a context and a query. Please answer the query accurately using **only** the information given in the context. Do not use any prior knowledge or outside information. If you cannot answer the query based on the context provided, please state that you are unsure and suggest helpful links or resources where the information might be found. Before you respond, **think through the problem step by step**, take a deep breath, and reason carefully to ensure your answer is thorough and accurate.

**Instructions:**

- Use only the information in the context to answer the query.
- Do not include any external information or make assumptions beyond the context.
- If the context lacks sufficient information, state that you are unsure.
- Provide helpful resources or links for further information if needed.
- **Think step by step** and reason through the problem before responding.
- Provide a clear and concise answer in complete sentences.
```


### **2. Updated Pull Request (PR) Description**

---

**Title:** Add Expanded Prompt Template for LangChain in `.txt` Format

**Description:**
This PR introduces a new `.txt` file containing an expanded prompt template for LangChain, which can be utilized to generate responses based on a specific context and query. The prompt is designed to ensure responses are accurate, based solely on provided context, and thoughtful. It includes detailed instructions for clarity and consistency in answering queries.

### **Changes Made:**

1. **Prompt Template Creation:**  
   - Created a `.txt` file with structured instructions for responding to queries based on a provided context. The prompt instructs the language model to:
     - Answer queries strictly using the context.
     - Avoid external knowledge or assumptions.
     - Reason step-by-step before answering.
     - Suggest resources if the context lacks sufficient information.

2. **Usage Example (Documentation):**
   - Added example code for loading the `.txt` file into a `PromptTemplate` in LangChain. This example demonstrates formatting the prompt with dynamic `{context}` and `{query}` variables.

### **Testing and Verification:**

- Verified that the prompt template can be loaded into a `PromptTemplate` instance in LangChain.
- Tested placeholder replacement with example inputs to ensure proper functionality.

### **Rationale:**

This prompt template in `.txt` format allows for efficient, context-based responses while maintaining high standards of accuracy and relevance. It will be useful for scenarios where the model must adhere strictly to given context without external information, enhancing the consistency of generated responses.
@azavalny azavalny closed this Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants