Harrison/quick start (#12491)

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Harrison Chase
2023-10-28 16:26:52 -07:00
committed by GitHub
parent e130680d74
commit 221134d239
13 changed files with 220 additions and 39 deletions

View File

@@ -0,0 +1,43 @@
# Contributing
Thanks for taking the time to contribute a new template!
We've tried to make this process as simple and painless as possible.
If you need any help at all, please reach out!
To contribute a new template, first fork this repository.
Then clone that fork and pull it down locally.
Set up an appropriate dev environment, and make sure you are in this `template` directory.
Make sure you have `langchain-cli` installed.
```shell
pip install -U "langchain-cli[serve]"
```
You can then run the following command to create a new skeleton of a package.
By convention, package names should use `-` delimeters (not `_`).
```shell
langchain hub new $PROJECT_NAME
```
You can then edit the contents of the package as you desire.
Note that by default we expect the main chain to be exposed as `chain` in the `__init__.py` file of the package.
You can change this (either the name or the location), but if you do so it is important to update the `tool.langchain`
part of `pyproject.toml`.
For example, if you update the main chain exposed to be called `agent_executor`, then that section should look like:
```text
[tool.langserve]
export_module = "..."
export_attr = "agent_executor"
```
Make sure to add any requirements of the package to `pyproject.toml` (and to remove any that are not used).
Please update the `README.md` file to give some background on your package and how to set it up.
If you want to change the license of your template for whatever, you may! Note that by default it is MIT licensed.
If you want to test out your package at any point in time, you can spin up a LangServe instance directly from the package.
See instructions [here](LAUNCHING_PACKAGE.md) on how to best do that.

13
templates/docs/INDEX.md Normal file
View File

@@ -0,0 +1,13 @@
# Templates
A list of all template repos
⭐Retrieval Augmented Generation Chatbot: Build a chatbot over your data. Uses OpenAI and Pinecone.
⭐Extraction with OpenAI Functions: Do extraction of structured data from unstructured data. Uses OpenAI function calling.
⭐Local Retrieval Augmented Generation: Build a chatbot over your data. Uses only local tooling: Ollama, GPT4all, Chroma.
⭐OpenAI Functions Agent: Build a chatbot that can take actions. Uses OpenAI function calling and Tavily.
⭐XML Agent: Build a chatbot that can take actions. Uses Anthropic and You.com.

View File

@@ -0,0 +1,41 @@
# Launching LangServe from a Package
You can also launch LangServe directly from a package, without having to pull it into a project.
This can be useful when you are developing a package and want to test it quickly.
The downside of this is that it gives you a little less control over how the LangServe APIs are configured,
which is why for proper projects we recommend creating a full project.
In order to do this, first change your working directory to the package itself.
For example, if you are currently in this `templates` module, you can go into the `pirate-speak` package with:
```shell
cd pirate-speak
```
Inside this package there is a `pyproject.toml` file.
This file contains a `tool.langchain` section that contains information on how this package should be used.
For example, in `pirate-speak` we see:
```text
[tool.langserve]
export_module = "pirate_speak.chain"
export_attr = "chain"
```
This information can be used to launch a LangServe instance automatically.
In order to do this, first make sure the CLI is installed:
```shell
pip install -U "langchain-cli[serve]"
```
You can then run:
```shell
langchain hub start
```
This will spin up endpoints, documentation, and playground for this chain.
For example, you can access the playground at [http://127.0.0.1:8000/playground/](http://127.0.0.1:8000/playground/)
![playground.png](playground.png)

BIN
templates/docs/docs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB