Skip to content

Commit

Permalink
Assistant Architect - File base improvements (LangChain documentation…
Browse files Browse the repository at this point in the history
…: More powerful code examples) | AdversarialPromptChain Python module | Python module revisions(#55)

See changelog
  • Loading branch information
Daethyra authored Dec 3, 2023
2 parents 917dd12 + 70f9302 commit 58e351e
Show file tree
Hide file tree
Showing 50 changed files with 3,780 additions and 187 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/gpt-crawler"]
path = src/gpt-crawler
url = https://github.com/daethyra/gpt-crawler
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# LangChain Core Concepts

## Introduction
Welcome to the comprehensive guide for LangChain, LangServe, and LangSmith. These powerful tools collectively offer a robust framework for building, deploying, and managing advanced AI and language model applications.
Welcome to the comprehensive guide for LangChain, LangServe, and LangSmith.

- **LangChain**: A versatile toolkit for creating and managing chains of language models and AI functionalities, facilitating complex tasks and interactions.
- **LangServe**: Dedicated to server-side operations, LangServe manages the deployment and scaling of language models, ensuring efficient and reliable performance.
- **LangSmith**: Focused on tracing, debugging, and detailed analysis, LangSmith provides the necessary tools to monitor, evaluate, and improve AI applications.

This documentation aims to provide users, developers, and AI enthusiasts with a thorough understanding of each tool's capabilities, practical applications, and best practices for integration and usage. Whether you're building sophisticated AI-driven applications or seeking to enhance existing systems with cutting-edge language technologies, these documents will serve as your roadmap to mastering LangChain, LangServe, and LangSmith.

---

## Core Concepts
Expand All @@ -35,8 +33,6 @@ print(response.content)
```
- **Explanation**: This code block shows how to create a simple chain that asks the AI to generate a joke based on a user-provided topic. `ChatPromptTemplate` is used to format the prompt, and `ChatOpenAI` is the model that generates the response.

---

### Section: Memory
- **Objective**: To illustrate how to integrate memory into a LangChain application, enabling the chain to maintain context across interactions. This is particularly useful for applications like chatbots where retaining context from previous interactions is crucial.
- **Example Code**:
Expand Down Expand Up @@ -77,8 +73,6 @@ memory.save_context({"input": "Tell me about LangChain"}, {"output": response.co
```
- **Explanation**: This code demonstrates the use of `ConversationBufferMemory` to keep a record of the conversation. The `ChatPromptTemplate` is configured to include a history of messages, allowing the model to generate responses considering previous interactions.

---

### Section: Using Tools
- **Objective**: To demonstrate how to integrate third-party tools into a LangChain application, thereby enhancing its capabilities. This example will specifically show how to use the `DuckDuckGoSearchRun` tool within a LangChain for web searches.
- **Example Code**:
Expand Down Expand Up @@ -110,4 +104,4 @@ print(search_result)
```
- **Explanation**: This example shows the use of `DuckDuckGoSearchRun` to perform web searches. The user's input is formatted into a search query using `ChatPromptTemplate`, passed through a chat model, and then processed by the search tool to retrieve information.

---
---
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# LangChain/Serve/Smith Advanced Features
# LangChain Advanced Features

## Introduction

Building on the core concepts, this guide covers advanced features like embeddings, prompt management, agents, and code writing. These empower sophisticated applications.

### Section: Embedding Router
- **Objective**: To explain and demonstrate the use of embeddings to dynamically route queries to the most relevant prompt based on semantic similarity. This advanced feature allows LangChain applications to handle a variety of inputs more intelligently.
- **Objective**: To answer "what are routers?" and demonstrate the use of embeddings to dynamically route queries to the most relevant prompt based on semantic similarity. This advanced feature allows LangChain applications to handle a variety of inputs more intelligently.
- **Example Code**:
```python
from langchain.chat_models import ChatOpenAI
Expand Down Expand Up @@ -183,4 +183,4 @@ print(code_result)
```
- **Explanation**: This code block demonstrates how LangChain can be used to automatically generate Python code in response to a given problem statement. The `ChatPromptTemplate` guides the AI to focus on code generation, and the output is sanitized and executed using `PythonREPL`. This illustrates LangChain's capability in automating and assisting with coding tasks.

---
---

This file was deleted.

Loading

0 comments on commit 58e351e

Please sign in to comment.