arize-phoenix 0.0.31rc1__py3-none-any.whl → 0.0.31rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arize-phoenix
3
- Version: 0.0.31rc1
3
+ Version: 0.0.31rc2
4
4
  Summary: ML Observability in your notebook
5
5
  Project-URL: Documentation, https://docs.arize.com/phoenix/
6
6
  Project-URL: Issues, https://github.com/Arize-ai/phoenix/issues
@@ -43,6 +43,7 @@ Requires-Dist: pytest-lazy-fixture; extra == 'dev'
43
43
  Requires-Dist: strawberry-graphql[debug-server]==0.178.0; extra == 'dev'
44
44
  Provides-Extra: experimental
45
45
  Requires-Dist: openai; extra == 'experimental'
46
+ Requires-Dist: tenacity; extra == 'experimental'
46
47
  Description-Content-Type: text/markdown
47
48
 
48
49
  <p align="center">
@@ -1,4 +1,4 @@
1
- phoenix/__init__.py,sha256=ukB4dMaixHY_wfB6pDmvBj6oV3RAm2RmV_7igCL4SX0,1117
1
+ phoenix/__init__.py,sha256=sfBQ2lmi-mb29hU-W-ZqstA9EALGX5n--2dKGf1PSJE,1192
2
2
  phoenix/config.py,sha256=tjNn9oqDxQmeO85sCchLlTsDiRJ6AoK0CTt_Uc_hrKM,1442
3
3
  phoenix/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
4
  phoenix/services.py,sha256=BlQF7lTQwhXUHBZBjZOoTnDM2Qni_hziUXsfp1Hux4Q,3978
@@ -17,7 +17,7 @@ phoenix/datasets/schema.py,sha256=HlM0f-pLFul2sYyHZM-Av8OFxLFkn57dkK_BWbMzyJY,66
17
17
  phoenix/datasets/validation.py,sha256=dZ9lCFUV0EY7HCkQkQBrs-GLAEIZdpOqUxwD5l4dp88,8294
18
18
  phoenix/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  phoenix/experimental/evals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- phoenix/experimental/evals/retrievals.py,sha256=H594kDv6qOxd8epAxFKh_kz297L25ecGTp6G8ID4V-c,3298
20
+ phoenix/experimental/evals/retrievals.py,sha256=3PBv2yFIcxdn_y-L6We554TsozqCDjTVBE8017RB2mY,3793
21
21
  phoenix/metrics/README.md,sha256=5gekqTU-5gGdMwvcfNp2Wlu8p1ul9kGY_jq0XXQusoI,1964
22
22
  phoenix/metrics/__init__.py,sha256=sLp7td1GIt_0Z8dPUyP4L0-_4x9c871yAaGX30oMsvg,2433
23
23
  phoenix/metrics/binning.py,sha256=CXPPcAkRmmR__IG36a6UGs5RBtgXXPuWQbafPtuG1ww,12787
@@ -91,8 +91,8 @@ phoenix/server/static/index.js,sha256=SJnIFu7ufB_k38YBCI7D1btTSq4mmE7WkUf1iOBxiG
91
91
  phoenix/server/static/modernizr.js,sha256=mvK-XtkNqjOral-QvzoqsyOMECXIMu5BQwSVN_wcU9c,2564
92
92
  phoenix/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  phoenix/session/session.py,sha256=WwGH7qStR4kAhmrRsw35BwXvCQDnEWpGm0crjyrWTvs,9519
94
- arize_phoenix-0.0.31rc1.dist-info/METADATA,sha256=JZOhMfioqzOpYfFFfwudgDFGpzDAauRnSOathIlO7Ms,10928
95
- arize_phoenix-0.0.31rc1.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
96
- arize_phoenix-0.0.31rc1.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
97
- arize_phoenix-0.0.31rc1.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
98
- arize_phoenix-0.0.31rc1.dist-info/RECORD,,
94
+ arize_phoenix-0.0.31rc2.dist-info/METADATA,sha256=iRpUMDo-rwHxcjDEUL4JY3HRi0Zma4Yz9nNWu0Z22hI,10977
95
+ arize_phoenix-0.0.31rc2.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
96
+ arize_phoenix-0.0.31rc2.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
97
+ arize_phoenix-0.0.31rc2.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
98
+ arize_phoenix-0.0.31rc2.dist-info/RECORD,,
phoenix/__init__.py CHANGED
@@ -2,8 +2,9 @@ from .datasets.dataset import Dataset
2
2
  from .datasets.fixtures import ExampleDatasets, load_example
3
3
  from .datasets.schema import EmbeddingColumnNames, RetrievalEmbeddingColumnNames, Schema
4
4
  from .session.session import Session, active_session, close_app, launch_app
5
+ from .trace.fixtures import load_example_traces
5
6
 
6
- __version__ = "0.0.31rc1"
7
+ __version__ = "0.0.31rc2"
7
8
 
8
9
  # module level doc-string
9
10
  __doc__ = """
@@ -32,4 +33,5 @@ __all__ = [
32
33
  "close_app",
33
34
  "launch_app",
34
35
  "Session",
36
+ "load_example_traces",
35
37
  ]
@@ -2,7 +2,7 @@
2
2
  Helper functions for evaluating the retrieval step of retrieval-augmented generation.
3
3
  """
4
4
 
5
- from typing import List, Optional, Tuple
5
+ from typing import List, Optional
6
6
 
7
7
  import openai
8
8
  from tenacity import (
@@ -26,29 +26,26 @@ _QUERY_CONTEXT_PROMPT_TEMPLATE = """# Query: {query}
26
26
  # Answer ("relevant" or "irrelevant"): """
27
27
 
28
28
 
29
- def compute_precisions_at_k_and_relevance_classifications(
30
- query_texts: List[str],
31
- list_of_retrieved_document_texts: List[List[str]],
32
- model_name: str = "gpt-4",
33
- ) -> Tuple[List[List[Optional[float]]], List[List[Optional[bool]]]]:
34
- if len(query_texts) != len(list_of_retrieved_document_texts):
35
- raise ValueError()
36
- list_of_precisions_at_k_lists: List[List[Optional[float]]] = []
37
- list_of_relevance_classifications_lists: List[List[Optional[bool]]] = []
38
- for query_text, retrieved_document_texts in zip(query_texts, list_of_retrieved_document_texts):
39
- relevance_classifications = [
40
- classify_relevance(query_text, document, model_name=model_name)
41
- for document in retrieved_document_texts
42
- ]
43
- precisions_at_k = compute_precisions_at_k(relevance_classifications)
44
- list_of_relevance_classifications_lists.append(relevance_classifications)
45
- list_of_precisions_at_k_lists.append(precisions_at_k)
46
- return list_of_precisions_at_k_lists, list_of_relevance_classifications_lists
47
-
48
-
49
29
  def compute_precisions_at_k(
50
30
  relevance_classifications: List[Optional[bool]],
51
31
  ) -> List[Optional[float]]:
32
+ """Given a list of relevance classifications, computes precision@k for k = 1, 2, ..., n, where
33
+ n is the length of the input list.
34
+
35
+ Args:
36
+ relevance_classifications (List[Optional[bool]]): A list of relevance classifications for a
37
+ set of retrieved documents, sorted by order of retrieval (i.e., the first element is the
38
+ classification for the first retrieved document, the second element is the
39
+ classification for the second retrieved document, etc.). The list may contain None
40
+ values, which indicate that the relevance classification for the corresponding document
41
+ is unknown.
42
+
43
+ Returns:
44
+ List[Optional[float]]: A list of precision@k values for k = 1, 2, ..., n, where n is the
45
+ length of the input list. The first element is the precision@1 value, the second element
46
+ is the precision@2 value, etc. If the input list contains any None values, those values
47
+ are omitted when computing the precision@k values.
48
+ """
52
49
  precisions_at_k = []
53
50
  num_relevant_classifications = 0
54
51
  num_non_none_classifications = 0
@@ -66,6 +63,18 @@ def compute_precisions_at_k(
66
63
 
67
64
  @retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
68
65
  def classify_relevance(query: str, document: str, model_name: str) -> Optional[bool]:
66
+ """Given a query and a document, determines whether the document contains an answer to the
67
+ query.
68
+
69
+ Args:
70
+ query (str): The query text. document (str): The document text. model_name (str): The name
71
+ of the OpenAI API model to use for the classification.
72
+
73
+ Returns:
74
+ Optional[bool]: A boolean indicating whether the document contains an answer to the query
75
+ (True meaning relevant, False meaning irrelevant), or None if the LLM produces an
76
+ unparseable output.
77
+ """
69
78
  prompt = _QUERY_CONTEXT_PROMPT_TEMPLATE.format(
70
79
  query=query,
71
80
  reference=document,