fairo 25.8.2__tar.gz → 25.9.1__tar.gz

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 fairo might be problematic. Click here for more details.

Files changed (48) hide show
  1. {fairo-25.8.2 → fairo-25.9.1}/PKG-INFO +2 -4
  2. fairo-25.9.1/fairo/__init__.py +1 -0
  3. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/chat/chat.py +6 -10
  4. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/execution/executor.py +8 -6
  5. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/workflow/dependency.py +11 -146
  6. {fairo-25.8.2 → fairo-25.9.1}/fairo.egg-info/PKG-INFO +2 -4
  7. {fairo-25.8.2 → fairo-25.9.1}/fairo.egg-info/requires.txt +1 -3
  8. {fairo-25.8.2 → fairo-25.9.1}/pyproject.toml +1 -3
  9. fairo-25.8.2/fairo/__init__.py +0 -1
  10. {fairo-25.8.2 → fairo-25.9.1}/README.md +0 -0
  11. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/__init__.py +0 -0
  12. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/__init__.py +0 -0
  13. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/base_agent.py +0 -0
  14. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/code_analysis_agent.py +0 -0
  15. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/output/__init__.py +0 -0
  16. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/output/base_output.py +0 -0
  17. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/output/google_drive.py +0 -0
  18. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/tools/__init__.py +0 -0
  19. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/tools/base_tools.py +0 -0
  20. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/tools/code_analysis.py +0 -0
  21. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/tools/utils.py +0 -0
  22. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/agent/utils.py +0 -0
  23. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/chat/__init__.py +0 -0
  24. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/client/__init__.py +0 -0
  25. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/client/client.py +0 -0
  26. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/exceptions.py +0 -0
  27. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/execution/__init__.py +0 -0
  28. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/execution/agent_serializer.py +0 -0
  29. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/execution/env_finder.py +0 -0
  30. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/execution/model_log_helper.py +0 -0
  31. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/models/__init__.py +0 -0
  32. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/models/custom_field_value.py +0 -0
  33. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/models/resources.py +0 -0
  34. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/runnable/__init__.py +0 -0
  35. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/runnable/runnable.py +0 -0
  36. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/workflow/__init__.py +0 -0
  37. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/workflow/base_workflow.py +0 -0
  38. {fairo-25.8.2 → fairo-25.9.1}/fairo/core/workflow/utils.py +0 -0
  39. {fairo-25.8.2 → fairo-25.9.1}/fairo/metrics/__init__.py +0 -0
  40. {fairo-25.8.2 → fairo-25.9.1}/fairo/metrics/fairness_object.py +0 -0
  41. {fairo-25.8.2 → fairo-25.9.1}/fairo/metrics/metrics.py +0 -0
  42. {fairo-25.8.2 → fairo-25.9.1}/fairo/settings.py +0 -0
  43. {fairo-25.8.2 → fairo-25.9.1}/fairo/tests/__init__.py +0 -0
  44. {fairo-25.8.2 → fairo-25.9.1}/fairo/tests/test_metrics.py +0 -0
  45. {fairo-25.8.2 → fairo-25.9.1}/fairo.egg-info/SOURCES.txt +0 -0
  46. {fairo-25.8.2 → fairo-25.9.1}/fairo.egg-info/dependency_links.txt +0 -0
  47. {fairo-25.8.2 → fairo-25.9.1}/fairo.egg-info/top_level.txt +0 -0
  48. {fairo-25.8.2 → fairo-25.9.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fairo
3
- Version: 25.8.2
3
+ Version: 25.9.1
4
4
  Summary: SDK for interfacing with Fairo SaaS platform.
5
5
  Author-email: "Fairo Systems, Inc." <support@fairo.ai>
6
6
  License: Apache-2.0
@@ -11,14 +11,12 @@ Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Description-Content-Type: text/markdown
14
- Requires-Dist: mlflow<=3.2.0,>=3.1.0
14
+ Requires-Dist: mlflow<=3.1.1,>=3.1.0
15
15
  Requires-Dist: langchain<0.4.0,>=0.3.20
16
16
  Requires-Dist: langchain-aws<0.3.0,>=0.2.18
17
17
  Requires-Dist: langchain-community<0.4.0,>=0.3.20
18
18
  Requires-Dist: langchain-core<0.4.0,>=0.3.49
19
19
  Requires-Dist: langchain-text-splitters<0.4.0,>=0.3.7
20
- Requires-Dist: psycopg2-binary<3.0.0,>=2.9.0
21
- Requires-Dist: langchain-postgres<0.1.0,>=0.0.14
22
20
  Requires-Dist: setuptools>=79.0.0
23
21
  Requires-Dist: pandas<3.0.0,>=2.0.0
24
22
 
@@ -0,0 +1 @@
1
+ __version__ = "25.9.1"
@@ -31,10 +31,10 @@ class FairoDeploymentClient(BaseDeploymentClient):
31
31
 
32
32
  # Add authentication if needed
33
33
  auth = None
34
- if os.environ.get('MLFLOW_TRACKING_USERNAME') and os.environ.get('MLFLOW_TRACKING_PASSWORD'):
34
+ if os.environ.get('FAIRO_API_ACCESS_KEY_ID') and os.environ.get('FAIRO_API_SECRET'):
35
35
  auth = HTTPBasicAuth(
36
- os.environ.get('MLFLOW_TRACKING_USERNAME'),
37
- os.environ.get('MLFLOW_TRACKING_PASSWORD')
36
+ os.environ.get('FAIRO_API_ACCESS_KEY_ID'),
37
+ os.environ.get('FAIRO_API_SECRET')
38
38
  )
39
39
 
40
40
  # Make streaming request
@@ -116,10 +116,10 @@ class FairoDeploymentClient(BaseDeploymentClient):
116
116
 
117
117
  # Add authentication if needed
118
118
  auth = None
119
- if os.environ.get('MLFLOW_TRACKING_USERNAME') and os.environ.get('MLFLOW_TRACKING_PASSWORD'):
119
+ if os.environ.get('FAIRO_API_ACCESS_KEY_ID') and os.environ.get('FAIRO_API_SECRET'):
120
120
  auth = HTTPBasicAuth(
121
- os.environ.get('MLFLOW_TRACKING_USERNAME'),
122
- os.environ.get('MLFLOW_TRACKING_PASSWORD')
121
+ os.environ.get('FAIRO_API_ACCESS_KEY_ID'),
122
+ os.environ.get('FAIRO_API_SECRET')
123
123
  )
124
124
 
125
125
  if os.environ.get('MLFLOW_TRACKING_TOKEN'):
@@ -183,10 +183,6 @@ class ChatFairo(ChatMlflow):
183
183
 
184
184
  def __init__(self, **kwargs):
185
185
 
186
- # # TODO <- see if this can be improved
187
- # os.environ["MLFLOW_TRACKING_USERNAME"] = get_mlflow_user()
188
- # os.environ["MLFLOW_TRACKING_PASSWORD"] = get_mlflow_password()
189
-
190
186
  super().__init__(
191
187
  target_uri=os.environ.get('MLFLOW_GATEWAY_URI', get_mlflow_gateway_uri()),
192
188
  endpoint=os.environ.get('MLFLOW_GATEWAY_ROUTE', get_mlflow_gateway_chat_route()),
@@ -1,10 +1,12 @@
1
1
  import json
2
2
  import os
3
- from typing import List, Any, Callable, Dict, Union
3
+ from typing import List, Any, Callable, Dict, Optional, Type, Union
4
4
  from langchain_core.runnables import RunnableLambda, RunnableSequence
5
5
  from langchain.chains import SimpleSequentialChain
6
6
  import logging
7
7
 
8
+ from pydantic import BaseModel
9
+
8
10
  import mlflow
9
11
 
10
12
  from mlflow.models.signature import ModelSignature
@@ -23,7 +25,6 @@ logger = logging.getLogger(__name__)
23
25
  class FairoExecutor:
24
26
  def __init__(
25
27
  self,
26
- input_schema,
27
28
  agent_type: str = "Langchain",
28
29
  agents: List[Any] = [],
29
30
  verbose: bool = False,
@@ -33,11 +34,12 @@ class FairoExecutor:
33
34
  experiment_name: str = None,
34
35
  chain_class = SimpleSequentialChain,
35
36
  input_fields: List[str] = [],
37
+ input_schema: Optional[Type[BaseModel]] = None,
36
38
  ):
37
39
  if agents and runnable:
38
40
  raise ValueError("FairoExecutor cannot be initialized with both 'agents' and 'runnable'. Please provide only one.")
39
- if not input_fields:
40
- raise ValueError("Missing input_fields")
41
+ if not input_fields and not input_schema:
42
+ raise ValueError("Missing required parameters: please provide at least one of 'input_fields' or 'input_schema'")
41
43
  self.input_schema = input_schema
42
44
  self.agents = agents
43
45
  self.agent_type = agent_type
@@ -117,8 +119,8 @@ class FairoExecutor:
117
119
  fairo_settings = {
118
120
  "type": type,
119
121
  "process_graph": process_graph,
120
- "schema": self.input_schema.model_json_schema(),
121
- "input_fields": list(self.input_schema.model_fields.keys()),
122
+ "schema": self.input_schema.model_json_schema() if self.input_schema else None,
123
+ "input_fields": list(self.input_schema.model_fields.keys()) if self.input_schema else self.input_fields,
122
124
  }
123
125
  if process_graph:
124
126
  mlflow.log_text(json.dumps(fairo_settings, ensure_ascii=False, indent=2), artifact_file="fairo_settings.txt")
@@ -1,155 +1,16 @@
1
1
  import os
2
2
  from typing import Any, Dict, List, Optional, Tuple
3
- from langchain_aws import BedrockEmbeddings
4
3
  from langchain_community.embeddings.mlflow import MlflowEmbeddings
5
4
  from langchain_core.documents import Document
6
- from langchain_postgres import PGVector
7
- from fairo.settings import get_mlflow_gateway_embeddings_route, get_mlflow_gateway_uri
5
+ from fairo.settings import get_mlflow_gateway_embeddings_route, get_mlflow_gateway_uri, get_fairo_api_key, get_fairo_api_secret, get_fairo_base_url
8
6
  from fairo.core.client.client import BaseClient
9
- AWS_AI_EMBEDDING_MODEL = 'cohere.embed-english-v3'
10
7
  import requests
11
- import uuid
8
+ AWS_AI_EMBEDDING_MODEL = 'cohere.embed-english-v3'
12
9
 
13
10
 
14
11
  class BaseVectorStore:
15
12
  pass
16
13
 
17
-
18
- class PostgresVectorStore(BaseVectorStore):
19
- """
20
- A PostgreSQL-based vector store using LangChain and pgvector
21
- """
22
-
23
- def __init__(
24
- self,
25
- collection_name: str,
26
- embedding_model_id: str = AWS_AI_EMBEDDING_MODEL,
27
- region_name: str = None,
28
- collection_metadata: dict = None,
29
- connection_string: str = "postgresql://postgres:postgres@localhost:5432/vectordb",
30
- pre_delete_collection: bool = False,
31
- default_k: int = 5
32
- ):
33
- """
34
- Args:
35
- collection_name: Name of the collection in PostgreSQL
36
- embedding_model_id: Bedrock embedding model ID
37
- region_name: AWS region for Bedrock
38
- collection_metadata: Dict for what metadata we want to add to collection
39
- connection_string: PostgreSQL connection string
40
- """
41
- self.collection_name = collection_name
42
- self.connection_string = connection_string
43
-
44
- # Set up embeddings
45
- self.embeddings = MlflowEmbeddings(
46
- target_uri=get_mlflow_gateway_uri(),
47
- endpoint=get_mlflow_gateway_embeddings_route(),
48
- )
49
-
50
- if collection_metadata is not None:
51
- self.collection_metadata = collection_metadata
52
-
53
- # Initialize the PGVector store
54
- self.db = PGVector(
55
- collection_name=collection_name,
56
- connection=connection_string,
57
- collection_metadata=self.collection_metadata,
58
- embeddings=self.embeddings,
59
- pre_delete_collection=pre_delete_collection
60
- )
61
-
62
- self.default_k = default_k
63
-
64
- def add_documents(self, documents: List[Document]) -> None:
65
- """
66
- Args:
67
- documents: List of Document objects to add
68
- """
69
- if not documents:
70
- return
71
-
72
- # Add documents to PGVector
73
- self.db.add_documents(documents)
74
-
75
- def add_texts(self, texts: List[str], metadatas: Optional[List[Dict[str, Any]]] = None) -> None:
76
- """
77
- Args:
78
- texts: List of text strings to add
79
- metadatas: Optional list of metadata dictionaries
80
- """
81
- if not texts:
82
- return
83
-
84
- # Convert to Document objects
85
- documents = []
86
- for i, text in enumerate(texts):
87
- metadata = metadatas[i] if metadatas and i < len(metadatas) else {}
88
- documents.append(Document(page_content=text, metadata=metadata))
89
-
90
- # Add to vector store
91
- self.add_documents(documents)
92
-
93
- @staticmethod
94
- def _format_query(query):
95
- # Temporary fix, need to consider model / do more than truncate
96
- return query[0:2048]
97
-
98
- def similarity_search(self, query: str, k: int = None) -> List[Document]:
99
- """
100
- Args:
101
- query: The search query
102
- k: Number of results to return
103
- """
104
- formatted_query = self._format_query(query)
105
- if k is None:
106
- k = self.default_k
107
- return self.db.similarity_search(formatted_query, k=k)
108
-
109
- def similarity_search_with_score(self, query: str, k: int = 4) -> List[tuple[Document, float]]:
110
- """
111
- Args:
112
- query: The search query
113
- k: Number of results to return
114
- """
115
- formatted_query = self._format_query(query)
116
- if k is None:
117
- k = self.default_k
118
- return self.db.similarity_search_with_score(formatted_query, k=k)
119
-
120
- def delete(self) -> None:
121
- """Delete the collection from PostgreSQL."""
122
- try:
123
- # Use the internal PGVector method to delete a collection
124
- self.db._client.delete_collection(self.collection_name)
125
- except Exception as e:
126
- print(f"Error deleting collection: {str(e)}")
127
-
128
- @classmethod
129
- def from_existing(cls,
130
- collection_name: str,
131
- embedding_model_id: str = AWS_AI_EMBEDDING_MODEL,
132
- region_name: str = None,
133
- connection_string: str = "postgresql://postgres:postgres@localhost:5432/vectordb"):
134
- """
135
- Load an existing collection from PostgreSQL.
136
-
137
- Args:
138
- collection_name: Name of the existing collection
139
- embedding_model_id: Bedrock embedding model ID
140
- region_name: AWS region for Bedrock
141
- connection_string: PostgreSQL connection string
142
-
143
- Returns:
144
- PostgresVectorStore instance connected to the existing collection
145
- """
146
- return cls(
147
- collection_name=collection_name,
148
- embedding_model_id=embedding_model_id,
149
- region_name=region_name,
150
- connection_string=connection_string
151
- )
152
-
153
14
  class FairoVectorStore(BaseVectorStore):
154
15
  """
155
16
  A vector store implementation using the Fairo API
@@ -182,14 +43,18 @@ class FairoVectorStore(BaseVectorStore):
182
43
  self.collection_name = collection_name
183
44
 
184
45
  # Get credentials from parameters or environment
185
- self.username = username or os.environ.get("FAIRO_API_ACCESS_KEY_ID")
186
- self.password = password or os.environ.get("FAIRO_API_SECRET")
187
- self.api_url = api_url or os.environ.get("FAIRO_BASE_URL", "https://api.fairo.ai")
46
+ self.username = username or get_fairo_api_key()
47
+ self.password = password or get_fairo_api_secret()
48
+ self.api_url = api_url or get_fairo_base_url()
188
49
  self.fairo_auth_token = os.environ.get("FAIRO_AUTH_TOKEN")
189
-
50
+ # Setup credentials
190
51
  if not self.fairo_auth_token and (not self.username or not self.password):
191
52
  raise ValueError("Fairo API credentials must be provided either as FAIRO_AUTH_TOKEN or as parameters or in the FAIRO_USERNAME and FAIRO_PASSWORD environment variables")
192
53
 
54
+ if(self.username and self.password):
55
+ os.environ["MLFLOW_TRACKING_USERNAME"] = self.username
56
+ os.environ["MLFLOW_TRACKING_PASSWORD"] = self.password
57
+
193
58
  # Initialize API client
194
59
  self.client = BaseClient(
195
60
  base_url=self.api_url.rstrip('/'),
@@ -429,7 +294,7 @@ class FairoVectorStore(BaseVectorStore):
429
294
  collection_name: str,
430
295
  username: str = None,
431
296
  password: str = None,
432
- api_url: str = "https://api.fairo.ai",
297
+ api_url: str = get_fairo_base_url(),
433
298
  embedding_model_id: str = AWS_AI_EMBEDDING_MODEL,
434
299
  region_name: str = None):
435
300
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fairo
3
- Version: 25.8.2
3
+ Version: 25.9.1
4
4
  Summary: SDK for interfacing with Fairo SaaS platform.
5
5
  Author-email: "Fairo Systems, Inc." <support@fairo.ai>
6
6
  License: Apache-2.0
@@ -11,14 +11,12 @@ Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Description-Content-Type: text/markdown
14
- Requires-Dist: mlflow<=3.2.0,>=3.1.0
14
+ Requires-Dist: mlflow<=3.1.1,>=3.1.0
15
15
  Requires-Dist: langchain<0.4.0,>=0.3.20
16
16
  Requires-Dist: langchain-aws<0.3.0,>=0.2.18
17
17
  Requires-Dist: langchain-community<0.4.0,>=0.3.20
18
18
  Requires-Dist: langchain-core<0.4.0,>=0.3.49
19
19
  Requires-Dist: langchain-text-splitters<0.4.0,>=0.3.7
20
- Requires-Dist: psycopg2-binary<3.0.0,>=2.9.0
21
- Requires-Dist: langchain-postgres<0.1.0,>=0.0.14
22
20
  Requires-Dist: setuptools>=79.0.0
23
21
  Requires-Dist: pandas<3.0.0,>=2.0.0
24
22
 
@@ -1,10 +1,8 @@
1
- mlflow<=3.2.0,>=3.1.0
1
+ mlflow<=3.1.1,>=3.1.0
2
2
  langchain<0.4.0,>=0.3.20
3
3
  langchain-aws<0.3.0,>=0.2.18
4
4
  langchain-community<0.4.0,>=0.3.20
5
5
  langchain-core<0.4.0,>=0.3.49
6
6
  langchain-text-splitters<0.4.0,>=0.3.7
7
- psycopg2-binary<3.0.0,>=2.9.0
8
- langchain-postgres<0.1.0,>=0.0.14
9
7
  setuptools>=79.0.0
10
8
  pandas<3.0.0,>=2.0.0
@@ -20,14 +20,12 @@ classifiers = [
20
20
  "Operating System :: OS Independent",
21
21
  ]
22
22
  dependencies = [
23
- "mlflow>=3.1.0,<=3.2.0",
23
+ "mlflow>=3.1.0,<=3.1.1",
24
24
  "langchain>=0.3.20,<0.4.0",
25
25
  "langchain-aws>=0.2.18,<0.3.0",
26
26
  "langchain-community>=0.3.20,<0.4.0",
27
27
  "langchain-core>=0.3.49,<0.4.0",
28
28
  "langchain-text-splitters>=0.3.7,<0.4.0",
29
- "psycopg2-binary>=2.9.0,<3.0.0",
30
- "langchain-postgres>=0.0.14,<0.1.0",
31
29
  "setuptools>=79.0.0",
32
30
  "pandas>=2.0.0,<3.0.0"
33
31
  ]
@@ -1 +0,0 @@
1
- __version__ = "25.8.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes