<h1>Farsight <a href="https://PAIR-code.github.io/farsight/"><img align="right" alt="Farsight logo." src="public/android-chrome-192x192.png" width="36" height="36"></a></h1>
[![Github Actions Status](https://github.com/PAIR-code/farsight/workflows/build/badge.svg)](https://github.com/PAIR-code/farsight/actions/workflows/build.yml)
[![license](https://img.shields.io/badge/License-Apache_2.0-blue)](https://github.com/PAIR-code/farsight/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/v/@xiaohk/farsight?color=orange)](https://www.npmjs.com/package/@xiaohk/farsight)
[![pypi](https://img.shields.io/pypi/v/farsight?color=yellow)](https://pypi.org/project/farsight/)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1aTIW3tRX1BRcNMCg8bRKktpZxRXtMF3-?usp=sharing)
<!-- [![arxiv badge](https://img.shields.io/badge/arXiv-2401.14447-red)](https://arxiv.org/abs/2401.14447) -->
In situ interactive widgets for responsible AI 🌱
<table>
<tr>
<td colspan="2"><a href="https://PAIR-code.github.io/farsight"><img width="100%" src='https://github.com/poloclub/wordflow/assets/15007159/c2f01503-9eb7-477c-be20-0b92a2efd1f0'></a></td>
</tr>
<tr></tr>
<tr align="center">
<td><a href="https://PAIR-code.github.io/farsight">🚀 Farsight Demo</a></td>
<td><a href="https://youtu.be/BlSFbGkOlHk">📺 Demo Video</a></td>
<!-- <td><a href="https://youtu.be/l1mr9z1TuAk">👨🏻🏫 Conference Talk</a></td> -->
<!-- <td><a href="https://arxiv.org/abs/2401.14447">📖 Research Paper</a></td> -->
</tr>
</table>
## What is Farsight?
Farsight is a collection of _in situ_ interactive widgets that help large language model (LLM) prompt creators to envision potential harms associated with their AI applications.
With a novel _in situ_ design, contextual AI incident feed, and human-AI collaborative harm envisioning, Farsight empowers prompt creators with diverse backgrounds to be more mindful of responsible AI during early AI prototyping.
<table>
<td colspan="3">Widgets</td>
<tr></tr>
<tr>
<td>1️⃣</td>
<td><strong>Alert Symbol</strong></td>
<td>Alert users with potential risks of their prompts and AI applications</td>
</tr>
<tr></tr>
<tr>
<td>2️⃣</td>
<td><strong>Incident Panel</strong></td>
<td>Relevant cautionary tales for users' AI applications</td>
</tr>
<tr></tr>
<tr>
<td>3️⃣</td>
<td><strong>Use Case Panel</strong></td>
<td>LLM-generated diverse use cases, stakeholders, and harms</td>
</tr>
<tr></tr>
<tr>
<td>4️⃣</td>
<td><strong>Harm Envisioner</strong></td>
<td>Human-AI collaborative harm envisioning tool</td>
</tr>
<tr></tr>
<td colspan="3">Distributions</td>
<tr></tr>
<tr>
<td>📦</td>
<td><a href="https://pair-code.github.io/farsight/" >Live Demo</a></td>
<td>Try Farsight with Gemini Pro and GPT-3.5</td>
</tr>
<tr></tr>
<tr>
<td>📦</td>
<td><a href="https://github.com/PAIR-code/farsight/releases" >Chrome Extension</a></td>
<td>Google AI Studio support</td>
</tr>
<tr></tr>
<tr>
<td>📦</td>
<td><a href="https://pair-code.github.io/farsight/" >Python Package</a></td>
<td>Computational notebook support (Jupyter, Colab, VS Code notebook)</td>
</tr>
<tr></tr>
</table>
### Demo Video
<details>
<summary>Click to see the demo video!</summary>
<video src="https://github.com/poloclub/wordflow/assets/15007159/ce96979e-9973-4c8c-9264-eec610b11463"></video>
</details>
## Get Started
### Live Demo
For a live demo, visit: <https://PAIR-code.github.io/farsight/>.
### Computational Notebook
If you use computational notebooks (e.g., Jupyter Notebook, JupyterLab, Google Colab, VS Code Notebook), you can easily use Farsight via its Python Package. We recommend using [StickyLand](https://github.com/xiaohk/stickyland) to enable sticky cells.
Visit this [Colab Notebook](https://colab.research.google.com/drive/1aTIW3tRX1BRcNMCg8bRKktpZxRXtMF3-?usp=sharing) for a demo.
```python
# Install Farsight
!pip install farsight
prompt = "Translate a sentence from English to French."
# Alert Symbol
farsight.symbol(prompt)
# Awareness Sidebar
farsight.sidebar(prompt)
# Harm Envisioner
farsight.envision(prompt)
```
### Google AI Studio
If you use Google AI Studio to prototype AI applications, you can manually install our Chrome Extension package from the [latest release](https://github.com/PAIR-code/farsight/releases).
1. Download `farsight.crx`
2. Open `chrome://extensions/` in Chrome
3. Drag `farsight.crx` into the page
4. Visit [Google AI Studio](https://aistudio.google.com/app/prompts/new_chat) and you will see Farsight :)
## Integrating Farsight into Prompting Tools
If you are a developer of web-based prompting tools, you can easily integrate different Farsight widgets into your tool regardless of your development stacks (e.g., React, Svelte, or Vanilla JS).
First, install Farsight's JavaScript package:
```bash
npm install --save-dev @xiaohk/farsight
```
Then, you can use Farsight as Web Components.
JavaScript:
```typescript
import '@xiaohk/farsight';
import {
FarsightContainer,
FarsightContainerLite,
FarsightContainerSignal
} from '@xiaohk/farsight';
```
HTML:
```html
<farsight-container-signal
prompt="Translate a sentence from English to French"
></farsight-container-signal>
```
## Developing Farsight
Clone or download this repository:
```bash
git clone git@github.com:PAIR-code/farsight.git
```
Install the dependencies:
```bash
npm install
```
Then run Farsight:
```bash
npm run dev
```
Navigate to [localhost:3000](https://localhost:3000). You should see Farsight running in your browser :)
## How is Farsight Built?
Farsight is a collection of [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) that developers can easily integrate into their web apps regardless of their development stack (e.g., Angular, React, Svelte). Farsight is written in TypeScript using [LIT Element](https://lit.dev/) as a framework. Farsight uses [D3.js](https://github.com/d3/d3) to implement the interactive tree visualization. The relevant AI incidents are from the [AI Incident Database](https://incidentdatabase.ai/), and the harm category is from the [sociotechnical harm taxonomy](https://arxiv.org/abs/2210.05791). The computational notebook support is enabled by [NOVA](https://github.com/poloclub/nova).
## Credits
Led by <a href='https://zijie.wang/' target='_blank'>Jay Wang</a>, Farsight is a result of a collaboration between researchers from Google Research, Georgia Tech, eBay, and Emory University. Farsight is created by <a href='https://zijie.wang/' target='_blank'>Jay Wang</a>, <a href='https://www.cs.emory.edu/people/faculty/individual.php?NUM=709' target='_blank'>Chinmay Kulkarni</a>, <a href='https://research.google/people/106542/' target='_blank'>Lauren Wilcox</a>, <a href='https://research.google/people/107786' target='_blank'>Mike Terry</a>, and <a href='http://michaelmadaio.com/' target='_blank'>Michael Madaio</a>.
## License
- The software is available under the [Apache License 2.0](https://github.com/PAIR-code/farsight/blob/master/LICENSE).
- The random prompts in [`public/data/random-prompts.json`](public/data/random-prompts.json`) are from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) with a [CC0 license](https://creativecommons.org/share-your-work/public-domain/cc0/).
## Contact
If you have any questions, feel free to [open an issue](https://github.com/PAIR-code/farsight/issues/new) or contact [Jay Wang](https://zijie.wang).
Raw data
{
"_id": null,
"home_page": "https://github.com/PAIR-code/farsight",
"name": "farsight",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "Jupyter,JupyterLab,JupyterLab3,Machine Learning,LLM,Gemini Pro,Responsible AI,AI,Large Language Model,ChatGPT",
"author": "Jay Wang",
"author_email": "jayw@zijie.wang",
"download_url": "https://files.pythonhosted.org/packages/49/21/9eaf6d74dbb270446516a4d7329a051147da56478f9cceebbbd7a17c2f91/farsight-0.1.6.tar.gz",
"platform": "Linux",
"description": "<h1>Farsight <a href=\"https://PAIR-code.github.io/farsight/\"><img align=\"right\" alt=\"Farsight logo.\" src=\"public/android-chrome-192x192.png\" width=\"36\" height=\"36\"></a></h1>\n\n[![Github Actions Status](https://github.com/PAIR-code/farsight/workflows/build/badge.svg)](https://github.com/PAIR-code/farsight/actions/workflows/build.yml)\n[![license](https://img.shields.io/badge/License-Apache_2.0-blue)](https://github.com/PAIR-code/farsight/blob/main/LICENSE)\n[![npm](https://img.shields.io/npm/v/@xiaohk/farsight?color=orange)](https://www.npmjs.com/package/@xiaohk/farsight)\n[![pypi](https://img.shields.io/pypi/v/farsight?color=yellow)](https://pypi.org/project/farsight/)\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1aTIW3tRX1BRcNMCg8bRKktpZxRXtMF3-?usp=sharing)\n\n<!-- [![arxiv badge](https://img.shields.io/badge/arXiv-2401.14447-red)](https://arxiv.org/abs/2401.14447) -->\n\nIn situ interactive widgets for responsible AI \ud83c\udf31\n\n<table>\n <tr>\n <td colspan=\"2\"><a href=\"https://PAIR-code.github.io/farsight\"><img width=\"100%\" src='https://github.com/poloclub/wordflow/assets/15007159/c2f01503-9eb7-477c-be20-0b92a2efd1f0'></a></td>\n </tr>\n <tr></tr>\n <tr align=\"center\">\n <td><a href=\"https://PAIR-code.github.io/farsight\">\ud83d\ude80 Farsight Demo</a></td>\n <td><a href=\"https://youtu.be/BlSFbGkOlHk\">\ud83d\udcfa Demo Video</a></td>\n <!-- <td><a href=\"https://youtu.be/l1mr9z1TuAk\">\ud83d\udc68\ud83c\udffb\u200d\ud83c\udfeb Conference Talk</a></td> -->\n <!-- <td><a href=\"https://arxiv.org/abs/2401.14447\">\ud83d\udcd6 Research Paper</a></td> -->\n </tr>\n</table>\n\n## What is Farsight?\n\nFarsight is a collection of _in situ_ interactive widgets that help large language model (LLM) prompt creators to envision potential harms associated with their AI applications.\nWith a novel _in situ_ design, contextual AI incident feed, and human-AI collaborative harm envisioning, Farsight empowers prompt creators with diverse backgrounds to be more mindful of responsible AI during early AI prototyping.\n\n<table>\n <td colspan=\"3\">Widgets</td>\n <tr></tr>\n <tr>\n <td>1\ufe0f\u20e3</td>\n <td><strong>Alert Symbol</strong></td>\n <td>Alert users with potential risks of their prompts and AI applications</td>\n </tr>\n <tr></tr>\n <tr>\n <td>2\ufe0f\u20e3</td>\n <td><strong>Incident Panel</strong></td>\n <td>Relevant cautionary tales for users' AI applications</td>\n </tr>\n <tr></tr>\n <tr>\n <td>3\ufe0f\u20e3</td>\n <td><strong>Use Case Panel</strong></td>\n <td>LLM-generated diverse use cases, stakeholders, and harms</td>\n </tr>\n <tr></tr>\n <tr>\n <td>4\ufe0f\u20e3</td>\n <td><strong>Harm Envisioner</strong></td>\n <td>Human-AI collaborative harm envisioning tool</td>\n </tr>\n <tr></tr>\n <td colspan=\"3\">Distributions</td>\n <tr></tr>\n <tr>\n <td>\ud83d\udce6</td>\n <td><a href=\"https://pair-code.github.io/farsight/\" >Live Demo</a></td>\n <td>Try Farsight with Gemini Pro and GPT-3.5</td>\n </tr>\n <tr></tr>\n <tr>\n <td>\ud83d\udce6</td>\n <td><a href=\"https://github.com/PAIR-code/farsight/releases\" >Chrome Extension</a></td>\n <td>Google AI Studio support</td>\n </tr>\n <tr></tr>\n <tr>\n <td>\ud83d\udce6</td>\n <td><a href=\"https://pair-code.github.io/farsight/\" >Python Package</a></td>\n <td>Computational notebook support (Jupyter, Colab, VS Code notebook)</td>\n </tr>\n <tr></tr>\n</table>\n\n### Demo Video\n\n<details>\n <summary>Click to see the demo video!</summary>\n <video src=\"https://github.com/poloclub/wordflow/assets/15007159/ce96979e-9973-4c8c-9264-eec610b11463\"></video>\n</details>\n\n## Get Started\n\n### Live Demo\n\nFor a live demo, visit: <https://PAIR-code.github.io/farsight/>.\n\n### Computational Notebook\n\nIf you use computational notebooks (e.g., Jupyter Notebook, JupyterLab, Google Colab, VS Code Notebook), you can easily use Farsight via its Python Package. We recommend using [StickyLand](https://github.com/xiaohk/stickyland) to enable sticky cells.\n\nVisit this [Colab Notebook](https://colab.research.google.com/drive/1aTIW3tRX1BRcNMCg8bRKktpZxRXtMF3-?usp=sharing) for a demo.\n\n```python\n# Install Farsight\n!pip install farsight\n\nprompt = \"Translate a sentence from English to French.\"\n\n# Alert Symbol\nfarsight.symbol(prompt)\n\n# Awareness Sidebar\nfarsight.sidebar(prompt)\n\n# Harm Envisioner\nfarsight.envision(prompt)\n```\n\n### Google AI Studio\n\nIf you use Google AI Studio to prototype AI applications, you can manually install our Chrome Extension package from the [latest release](https://github.com/PAIR-code/farsight/releases).\n\n1. Download `farsight.crx`\n2. Open `chrome://extensions/` in Chrome\n3. Drag `farsight.crx` into the page\n4. Visit [Google AI Studio](https://aistudio.google.com/app/prompts/new_chat) and you will see Farsight :)\n\n## Integrating Farsight into Prompting Tools\n\nIf you are a developer of web-based prompting tools, you can easily integrate different Farsight widgets into your tool regardless of your development stacks (e.g., React, Svelte, or Vanilla JS).\n\nFirst, install Farsight's JavaScript package:\n\n```bash\nnpm install --save-dev @xiaohk/farsight\n```\n\nThen, you can use Farsight as Web Components.\n\nJavaScript:\n\n```typescript\nimport '@xiaohk/farsight';\nimport {\n FarsightContainer,\n FarsightContainerLite,\n FarsightContainerSignal\n} from '@xiaohk/farsight';\n```\n\nHTML:\n\n```html\n<farsight-container-signal\n prompt=\"Translate a sentence from English to French\"\n></farsight-container-signal>\n```\n\n## Developing Farsight\n\nClone or download this repository:\n\n```bash\ngit clone git@github.com:PAIR-code/farsight.git\n```\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nThen run Farsight:\n\n```bash\nnpm run dev\n```\n\nNavigate to [localhost:3000](https://localhost:3000). You should see Farsight running in your browser :)\n\n## How is Farsight Built?\n\nFarsight is a collection of [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) that developers can easily integrate into their web apps regardless of their development stack (e.g., Angular, React, Svelte). Farsight is written in TypeScript using [LIT Element](https://lit.dev/) as a framework. Farsight uses [D3.js](https://github.com/d3/d3) to implement the interactive tree visualization. The relevant AI incidents are from the [AI Incident Database](https://incidentdatabase.ai/), and the harm category is from the [sociotechnical harm taxonomy](https://arxiv.org/abs/2210.05791). The computational notebook support is enabled by [NOVA](https://github.com/poloclub/nova).\n\n## Credits\n\nLed by <a href='https://zijie.wang/' target='_blank'>Jay Wang</a>, Farsight is a result of a collaboration between researchers from Google Research, Georgia Tech, eBay, and Emory University. Farsight is created by <a href='https://zijie.wang/' target='_blank'>Jay Wang</a>, <a href='https://www.cs.emory.edu/people/faculty/individual.php?NUM=709' target='_blank'>Chinmay Kulkarni</a>, <a href='https://research.google/people/106542/' target='_blank'>Lauren Wilcox</a>, <a href='https://research.google/people/107786' target='_blank'>Mike Terry</a>, and <a href='http://michaelmadaio.com/' target='_blank'>Michael Madaio</a>.\n\n## License\n\n- The software is available under the [Apache License 2.0](https://github.com/PAIR-code/farsight/blob/master/LICENSE).\n- The random prompts in [`public/data/random-prompts.json`](public/data/random-prompts.json`) are from [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) with a [CC0 license](https://creativecommons.org/share-your-work/public-domain/cc0/).\n\n## Contact\n\nIf you have any questions, feel free to [open an issue](https://github.com/PAIR-code/farsight/issues/new) or contact [Jay Wang](https://zijie.wang).\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "A Python package to run Farsight in your computational notebooks.",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/PAIR-code/farsight"
},
"split_keywords": [
"jupyter",
"jupyterlab",
"jupyterlab3",
"machine learning",
"llm",
"gemini pro",
"responsible ai",
"ai",
"large language model",
"chatgpt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "997f50e161037a7fd1add4408be67e2194db17f781b39453535a481a554f606e",
"md5": "c59bbd0bb8ac30a999fcd6ef1394d861",
"sha256": "c917b46c4967ff06d0e7a4a15a8a6133b7f6d34f6b84d48c66a6147dbc4fe518"
},
"downloads": -1,
"filename": "farsight-0.1.6-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "c59bbd0bb8ac30a999fcd6ef1394d861",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 883990,
"upload_time": "2024-02-22T01:48:22",
"upload_time_iso_8601": "2024-02-22T01:48:22.913861Z",
"url": "https://files.pythonhosted.org/packages/99/7f/50e161037a7fd1add4408be67e2194db17f781b39453535a481a554f606e/farsight-0.1.6-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49219eaf6d74dbb270446516a4d7329a051147da56478f9cceebbbd7a17c2f91",
"md5": "f212de4ac94af7c53acddc40522d0671",
"sha256": "5126d645f392494ed5c4742000083be901babe1c95d67483f246c377a1a91ace"
},
"downloads": -1,
"filename": "farsight-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "f212de4ac94af7c53acddc40522d0671",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 875680,
"upload_time": "2024-02-22T01:48:25",
"upload_time_iso_8601": "2024-02-22T01:48:25.174303Z",
"url": "https://files.pythonhosted.org/packages/49/21/9eaf6d74dbb270446516a4d7329a051147da56478f9cceebbbd7a17c2f91/farsight-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-22 01:48:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PAIR-code",
"github_project": "farsight",
"github_not_found": true,
"lcname": "farsight"
}