API Reference and Documentation
This documentation provides a detailed overview of the API endpoints, input parameters, expected outputs, and usage examples. It also explains the underlying concepts and architecture, with Mermaid diagrams where necessary.
API Overview
Our API allows you to create LangChain tools on-the-fly by generating solution sketches, source code, and unit tests. The API is built upon a powerful AI model that understands natural language and code, making it easy for developers to describe the functionality they want and get the relevant code and tests in return.
Endpoints
Create Solution Sketch
POST /api/v1/solution-sketch
Generate a solution sketch based on a provided tool description.
Input Parameters:
tool_description_prompt
String
A brief description of the functionality desired in the Tool.
Output:
A string containing the generated solution sketch for the LangChain tool.
Generate Tool Source Code
POST /api/v1/tool-source
Generate the source code of a LangChain Tool based on the provided solution sketch and tool tests.
Input Parameters:
solution_sketch_n_tool_tests
String
A string made of two substrings separated by '######SPLIT_TOKEN########', representing the solution sketch and tool tests code block.
Output:
A success message along with the generated source code of the LangChain tool.
Generate Tool Unit Tests
POST /api/v1/tool-tests
Generate the unit tests for a LangChain Tool based on the provided solution sketch.
Input Parameters:
solution_sketch
String
The solution sketch of the functionality desired in the Tool.
Output:
A success message along with the generated source code of the LangChain tool's unit tests.
Examples
Example 1: Creating a solution sketch
Request:
Response:
Example 2: Generating tool source code
Request:
Response:
Example 3: Generating tool unit tests
Request:
Response:
Concepts and Architecture
The API is built on the following components:
AI Model: A powerful AI model trained to understand natural language and code, making it easy for developers to describe the functionality they want in a tool.
Endpoints: The API provides endpoints for creating solution sketches, generating source code, and generating unit tests for LangChain tools.
LLMChain: The LLMChain (Language Model Layered Model Chain) is a mechanism that allows chaining together multiple prompts and language models, allowing the AI to provide context-aware and detailed responses.
Diagrams
This diagram demonstrates the flow of information between the user, API, AI model, and LLMChain. When the user sends a request to the API, it is forwarded to the AI model, which uses the LLMChain mechanism for context-aware responses. The AI model then returns the generated code or tests to the API, which sends the output back to the user.
Last updated