-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: update default value of variable in run_relevance_eval (GITBOOK-368) * docs: No subject (GITBOOK-369) * docs: Environment documentation (GITBOOK-370) * docs: Explanations (GITBOOK-371) --------- Co-authored-by: Xander Song <xsong@arize.com> Co-authored-by: Jason Lopatecki <jason@arize.com>
- Loading branch information
1 parent
1d88efd
commit 4d01e83
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
description: >- | ||
The Phoenix app can be run in various notebook environments such as colab and | ||
SageMaker as well as be served via the terminal or a docker container | ||
--- | ||
|
||
# Environments | ||
|
||
Phoenix app is first and foremost an application that can be run just in in your notebook! This makes it an extremely flexible app since it can be accessed directly as you iterate on your AI-powered app!\ | ||
|
||
|
||
### Notebooks | ||
|
||
Currently phoenix supports local, colab, and SageMaker notebooks. | ||
|
||
{% hint style="warning" %} | ||
Note, phoenix only supports running the phoenix server via the notebook for SageMaker notebooks. It cannot setup proxy requests for SageMaker studio since there is no support of jupyter-server-proxy | ||
{% endhint %} | ||
|
||
#### SageMaker | ||
|
||
With SageMaker notebooks, phoenix leverages the [jupyter-server-proy](https://github.com/jupyterhub/jupyter-server-proxy) to host the server under `proxy/6006.`Note, that phoenix will automatically try to detect that you are running in SageMaker but you can declare the notebook runtime via a parameter to `launch_app` or an environment variable | ||
|
||
{% tabs %} | ||
{% tab title="Environment Variable" %} | ||
```python | ||
import os | ||
|
||
os.envoron["PHOENIX_NOTEBOOK_ENV"] = "sagemaker" | ||
``` | ||
{% endtab %} | ||
|
||
{% tab title="Launch Parameter" %} | ||
```python | ||
import phoenix as px | ||
|
||
px.launch_app(notebook_environment="sagemaker") | ||
``` | ||
{% endtab %} | ||
{% endtabs %} | ||
|
||
### Container | ||
|
||
{% hint style="info" %} | ||
Container images are still actively being worked on. If you are interested in hosted phoenix, please get in touch! | ||
{% endhint %} | ||
|
||
Phoenix server images are now available via [Docker Hub](https://hub.docker.com/r/arizephoenix/phoenix). The hosted phoenix server runs as a trace collector and can be used if you want observability for LLM traces via docker compose or simply want a long-running phoenix instance. | ||
|
||
If you deploy the phoenix server (collector) to a remote machine, you will have to make sure to configure the remote endpoint as the collector endpoint. (This feature is only available after phoenix **1.3.x**) | ||
|
||
{% tabs %} | ||
{% tab title="Environment Variable" %} | ||
```python | ||
import os | ||
|
||
os.envoron["PHOENIX_COLLECTOR_ENDPOINT"] = "https://my-phoenix.io" | ||
``` | ||
{% endtab %} | ||
|
||
{% tab title="Second Tab" %} | ||
```python | ||
from phoenix.trace.tracer import Tracer | ||
from phoenix.trace.exporter import HttpExporter | ||
from phoenix.trace.openai.instrumentor import OpenAIInstrumentor | ||
|
||
|
||
tracer = Tracer(exporter=HttpExporter(endpoint="https://my-phoenix.io")) | ||
OpenAIInstrumentor(tracer).instrument() | ||
``` | ||
{% endtab %} | ||
{% endtabs %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Evals With Explanations | ||
|
||
{% embed url="https://colab.research.google.com/github/Arize-ai/phoenix/blob/main/tutorials/evals/evaluate_relevance_classifications.ipynb?#scrollTo=zUtDrplhZZJu&uniqifier=1" %} | ||
See "Classifications with Explanations Section" | ||
{% endembed %} | ||
|
||
It can be hard to understand in many cases why an LLM responds in a specific way. The explanation feature of Phoneix allows you to get a Eval output and an explanation from the LLM at the same time. We have found this incredibly useful for debugging LLM Evals. | ||
|
||
<pre class="language-python"><code class="lang-python">from phoenix.experimental.evals import ( | ||
RAG_RELEVANCY_PROMPT_RAILS_MAP, | ||
RAG_RELEVANCY_PROMPT_TEMPLATE, | ||
OpenAIModel, | ||
download_benchmark_dataset, | ||
llm_classify, | ||
) | ||
|
||
model = OpenAIModel( | ||
model_name="gpt-4", | ||
temperature=0.0, | ||
) | ||
|
||
#The rails is used to hold the output to specific values based on the template | ||
#It will remove text such as ",,," or "..." | ||
#Will ensure the binary value expected from the template is returned | ||
rails = list(RAG_RELEVANCY_PROMPT_RAILS_MAP.values()) | ||
relevance_classifications = llm_classify( | ||
dataframe=df, | ||
template=RAG_RELEVANCY_PROMPT_TEMPLATE, | ||
model=model, | ||
rails=rails, | ||
<a data-footnote-ref href="#user-content-fn-1">provide_explanation=True</a> | ||
) | ||
#relevance_classifications is a Dataframe with columns 'label' and 'explanation' | ||
</code></pre> | ||
|
||
The flag above can be set with any of the templates or your own custom templates. The example below is from a relevance Evaluation.  | ||
|
||
<figure><img src="../.gitbook/assets/explanation.png" alt=""><figcaption></figcaption></figure> | ||
|
||
|
||
|
||
[^1]: set to get an explanation out |