Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
hamelsmu committed Oct 14, 2023
1 parent 441f3c1 commit cccf69a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ to buid your own data inspection and curation infrastructure:
> OpenAI](https://x.com/_jasonwei/status/1708921475829481683?s=20)
`langfree` helps you export data from LangSmith and build data curation
web applications. By building you own data curation tools, so you can
add features you need like:
tools. By building you own data curation tools, so you can add features
you need like:

- connectivity to data sources beyond LangSmith.
- customized data transformations of runs.
- ability to route, tag and annotate data in special ways.
- … etc.

Furthermore,`langfree` provides a handful of [Shiny for
Python](04_shiny.ipynb) components to make the process of creating data
curation applications easier.
Python](04_shiny.ipynb) components ease the process of creating data
curation applications.

## Install

Expand Down Expand Up @@ -199,6 +199,41 @@ something that looks like this:

See the [docs site](http://langfree.parlance-labs.com/).

## FAQ

1. **We don’t use LangChain. Can we still use something from this
library?** No, not directly. However, we recommend looking at how
the [Shiny for Python App works](tutorials/shiny.ipynb) so you can
adapt it towards your own use cases.

2. **Why did you use [Shiny For Python](https://shiny.posit.co/py/)?**
Python has many great front-end libraries like Gradio, Streamlit,
Panel and others. However, we liked Shiny For Python the best,
because of its reactive model, modularity, strong integration with
[Quarto](https://quarto.org/), and [WASM
support](https://shiny.posit.co/py/docs/shinylive.html). You can
read more about it
[here](https://shiny.posit.co/py/docs/overview.html).

3. **Does this only work with runs from LangChain/LangSmith?** Yes,
`langfree` has only been tested with `LangChain` runs that have been
logged to`LangSmith`, however we suspect that you could log your
traces elsewhere and pull them in a similar manner.

4. **Does this only work with
[`ChatOpenAI`](https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.openai.ChatOpenAI.html)
runs?** A: Yes, `langfree` is opinionated and only works with runs
that use chat models from OpenAI (which use
[`ChatOpenAI`](https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.openai.ChatOpenAI.html)
in LangChain). We didn’t want to over-generalize this tool too
quickly and started with the most popular combination of things.

5. **Do you offer support?**: These tools are free and licensed under
[Apache
2.0](https://github.com/parlance-labs/langfree/blob/main/LICENSE).
If you want support or customization, feel free to [reach out to
us](https://parlance-labs.com/).

## Contributing

This library was created with [nbdev](https://nbdev.fast.ai/). See
Expand Down
21 changes: 19 additions & 2 deletions nbs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
"> \n",
"> -- [Jason Wei, AI Researcher at OpenAI](https://x.com/_jasonwei/status/1708921475829481683?s=20)\n",
"\n",
"`langfree` helps you export data from LangSmith and build data curation web applications. By building you own data curation tools, so you can add features you need like:\n",
"`langfree` helps you export data from LangSmith and build data curation tools. By building you own data curation tools, so you can add features you need like:\n",
"\n",
"- connectivity to data sources beyond LangSmith.\n",
"- customized data transformations of runs.\n",
"- ability to route, tag and annotate data in special ways.\n",
"- ... etc.\n",
"\n",
"Furthermore,`langfree` provides a handful of [Shiny for Python](04_shiny.ipynb) components to make the process of creating data curation applications easier."
"Furthermore,`langfree` provides a handful of [Shiny for Python](04_shiny.ipynb) components ease the process of creating data curation applications."
]
},
{
Expand Down Expand Up @@ -457,6 +457,23 @@
":::"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## FAQ\n",
"\n",
"1. **We don't use LangChain. Can we still use something from this library?** No, not directly. However, we recommend looking at how the [Shiny for Python App works](tutorials/shiny.ipynb) so you can adapt it towards your own use cases.\n",
"\n",
"2. **Why did you use [Shiny For Python](https://shiny.posit.co/py/)?** Python has many great front-end libraries like Gradio, Streamlit, Panel and others. However, we liked Shiny For Python the best, because of its reactive model, modularity, strong integration with [Quarto](https://quarto.org/), and [WASM support](https://shiny.posit.co/py/docs/shinylive.html). You can read more about it [here](https://shiny.posit.co/py/docs/overview.html).\n",
"\n",
"3. **Does this only work with runs from LangChain/LangSmith?** Yes, `langfree` has only been tested with `LangChain` runs that have been logged to`LangSmith`, however we suspect that you could log your traces elsewhere and pull them in a similar manner.\n",
"\n",
"4. **Does this only work with [`ChatOpenAI`](https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.openai.ChatOpenAI.html) runs?** A: Yes, `langfree` is opinionated and only works with runs that use chat models from OpenAI (which use [`ChatOpenAI`](https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.openai.ChatOpenAI.html) in LangChain). We didn't want to over-generalize this tool too quickly and started with the most popular combination of things.\n",
"\n",
"5. **Do you offer support?**: These tools are free and licensed under [Apache 2.0](https://github.com/parlance-labs/langfree/blob/main/LICENSE). If you want support or customization, feel free to [reach out to us](https://parlance-labs.com/).\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
10 changes: 9 additions & 1 deletion nbs/tutorials/shiny.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
"\n",
"### 1. Pull Data From Langsmith\n",
"\n",
":::{.callout-note}\n",
"### If you have not logged runs to LangSmith\n",
"\n",
"If you have not logged runs to LangSmith and want to see the app, you can skip to the next step and use the sample data in this repo, which is located in the [nbs/tutorials/_data](https://github.com/parlance-labs/langfree/tree/main/nbs/tutorials/_data) directory.\n",
"\n",
"However, it is probably more interesting to use this with your own data.\n",
":::\n",
"\n",
"First, we will pull data from LangSmith. There are many ways to do this, including using the `langsmith` client, which we illustrate below. \n",
"\n",
"We will pull four specific run ids, parse the data and save it to a dataframe named `sample_data.pkl` that we will use as our backend \"database\" [^2] for demo purposes. We initialize all records to have a status of `Pending`.\n",
Expand Down Expand Up @@ -89,7 +97,7 @@
"llm_data_df['status'] = 'Pending' # <6>\n",
"llm_data_df.to_pickle('_data/sample_data.pkl') # <7>\n",
"```\n",
"1. The [langsmith](https://github.com/langchain-ai/langsmith-sdk) offers the simplest way to retreive runs. However, there are additional utilities for retreiving runs provided in [`langfree.runs`](../01_runs.ipynb).\n",
"1. The [langsmith sdk](https://github.com/langchain-ai/langsmith-sdk) offers the simplest way to retreive runs. However, there are additional utilities for retreiving runs provided in [`langfree.runs`](../01_runs.ipynb).\n",
"2. `ChatRecordSet` allows you to parse and extract key information from your langchain [ChatOpenAI](https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.openai.ChatOpenAI.html) runs.\n",
"3. These are the run ids that we will pull from langsmith. You will have to pull your own run ids. Make sure that your runs have at least one child that is of type `ChatOpenAI` for this to work. \n",
"4. `ChatRecordSet.from_run_ids` allows you to fetch and parse this data froma list of run ids.\n",
Expand Down

0 comments on commit cccf69a

Please sign in to comment.