fairo 25.6.2__tar.gz → 25.6.5__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.
- {fairo-25.6.2 → fairo-25.6.5}/PKG-INFO +9 -9
- fairo-25.6.5/fairo/__init__.py +1 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/execution/env_finder.py +0 -1
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/execution/executor.py +56 -52
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/runnable/runnable.py +25 -13
- {fairo-25.6.2 → fairo-25.6.5}/fairo.egg-info/PKG-INFO +9 -9
- fairo-25.6.5/fairo.egg-info/requires.txt +8 -0
- {fairo-25.6.2 → fairo-25.6.5}/pyproject.toml +8 -8
- fairo-25.6.2/fairo/__init__.py +0 -17
- fairo-25.6.2/fairo.egg-info/requires.txt +0 -8
- {fairo-25.6.2 → fairo-25.6.5}/README.md +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/base_agent.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/code_analysis_agent.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/output/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/output/base_output.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/output/google_drive.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/tools/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/tools/base_tools.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/tools/code_analysis.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/tools/utils.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/agent/utils.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/chat/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/chat/chat.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/client/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/client/client.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/exceptions.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/execution/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/models/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/models/custom_field_value.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/models/resources.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/runnable/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/workflow/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/workflow/base_workflow.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/workflow/dependency.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/core/workflow/utils.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/metrics/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/metrics/fairness_object.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/metrics/metrics.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/settings.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/tests/__init__.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo/tests/test_metrics.py +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo.egg-info/SOURCES.txt +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo.egg-info/dependency_links.txt +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/fairo.egg-info/top_level.txt +0 -0
- {fairo-25.6.2 → fairo-25.6.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fairo
|
|
3
|
-
Version: 25.6.
|
|
3
|
+
Version: 25.6.5
|
|
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,14 @@ 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
|
|
15
|
-
Requires-Dist: langchain
|
|
16
|
-
Requires-Dist: langchain-aws
|
|
17
|
-
Requires-Dist: langchain-community
|
|
18
|
-
Requires-Dist: langchain-core
|
|
19
|
-
Requires-Dist: langchain-text-splitters
|
|
20
|
-
Requires-Dist: psycopg2-binary
|
|
21
|
-
Requires-Dist: langchain-postgres
|
|
14
|
+
Requires-Dist: mlflow<3.0.0,>=2.21.0
|
|
15
|
+
Requires-Dist: langchain<0.4.0,>=0.3.20
|
|
16
|
+
Requires-Dist: langchain-aws<0.3.0,>=0.2.18
|
|
17
|
+
Requires-Dist: langchain-community<0.4.0,>=0.3.20
|
|
18
|
+
Requires-Dist: langchain-core<0.4.0,>=0.3.49
|
|
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
22
|
|
|
23
23
|
# Fairo SDK
|
|
24
24
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "25.6.5"
|
|
@@ -33,7 +33,6 @@ def recursively_find_env_vars(start_path, exclude_dirs=None):
|
|
|
33
33
|
full_path = os.path.join(root, file)
|
|
34
34
|
file_vars = find_env_vars_in_file(full_path)
|
|
35
35
|
if file_vars:
|
|
36
|
-
print(f"Found in {full_path}: {file_vars}")
|
|
37
36
|
all_vars.update(file_vars)
|
|
38
37
|
return all_vars
|
|
39
38
|
|
|
@@ -25,13 +25,15 @@ logger = logging.getLogger(__name__)
|
|
|
25
25
|
class FairoExecutor:
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
|
-
agents: List[Any],
|
|
28
|
+
agents: List[Any] = [],
|
|
29
29
|
verbose: bool = False,
|
|
30
30
|
patch_run_output_json: Callable[[LLMAgentOutput], None] = None,
|
|
31
31
|
workflow_run_id: str = "",
|
|
32
32
|
runnable: Runnable = None,
|
|
33
33
|
experiment_name: str = None
|
|
34
34
|
):
|
|
35
|
+
if agents and runnable:
|
|
36
|
+
raise ValueError("FairoExecutor cannot be initialized with both 'agents' and 'runnable'. Please provide only one.")
|
|
35
37
|
self.agents = agents
|
|
36
38
|
self.verbose = verbose
|
|
37
39
|
self.patch_run_output_json = patch_run_output_json
|
|
@@ -86,43 +88,64 @@ class FairoExecutor:
|
|
|
86
88
|
return RunnableLambda(runnable_fn)
|
|
87
89
|
|
|
88
90
|
def _build_pipeline(self) -> RunnableSequence:
|
|
89
|
-
if not self.agents:
|
|
90
|
-
raise ValueError("At least one agent must be provided.")
|
|
91
|
+
if not self.agents and not self.runnable:
|
|
92
|
+
raise ValueError("At least one agent or runnable must be provided.")
|
|
93
|
+
|
|
94
|
+
if self.runnable:
|
|
95
|
+
pipeline = mlflow.langchain.load_model(self.runnable.artifact_path)
|
|
91
96
|
|
|
92
97
|
# Assign input/output keys
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
if len(self.agents) > 0:
|
|
99
|
+
for i, agent in enumerate(self.agents):
|
|
100
|
+
agent.input_key = "input" if i == 0 else f"output_{i - 1}"
|
|
101
|
+
agent.output_key = f"output_{i}"
|
|
102
|
+
|
|
103
|
+
runnables = []
|
|
104
|
+
for agent in self.agents:
|
|
105
|
+
runnables.append(
|
|
106
|
+
self._wrap_agent_runnable(agent, agent.input_key, agent.output_key)
|
|
107
|
+
)
|
|
108
|
+
first_input_key = self.agents[0].input_key
|
|
109
|
+
last_output_key = self.agents[-1].output_key
|
|
110
|
+
# Build RunnableSequence from all steps
|
|
111
|
+
pipeline = runnables[0]
|
|
112
|
+
for r in runnables[1:]:
|
|
113
|
+
pipeline = pipeline | r # chaining
|
|
114
|
+
|
|
115
|
+
input_schema = Schema([
|
|
116
|
+
ColSpec(type="string", name=first_input_key),
|
|
117
|
+
])
|
|
118
|
+
|
|
119
|
+
output_schema = Schema([
|
|
120
|
+
ColSpec(type="string", name=last_output_key),
|
|
121
|
+
])
|
|
122
|
+
model_info = mlflow.langchain.log_model(
|
|
123
|
+
pipeline,
|
|
124
|
+
artifact_path="",
|
|
125
|
+
signature=ModelSignature(inputs=input_schema, outputs=output_schema)
|
|
101
126
|
)
|
|
102
|
-
|
|
103
|
-
last_output_key = self.agents[-1].output_key
|
|
104
|
-
# Build RunnableSequence from all steps
|
|
105
|
-
pipeline = runnables[0]
|
|
106
|
-
for r in runnables[1:]:
|
|
107
|
-
pipeline = pipeline | r # chaining
|
|
108
|
-
|
|
127
|
+
|
|
109
128
|
def save_process_graph():
|
|
110
|
-
|
|
111
|
-
output_workflow_process_graph(self.agents)
|
|
112
|
-
if
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
if len(self.agents) > 0:
|
|
130
|
+
process_graph = output_workflow_process_graph(self.agents)
|
|
131
|
+
if len(self.agents) > 1:
|
|
132
|
+
type = "Workflow"
|
|
133
|
+
else:
|
|
134
|
+
type = "Agent"
|
|
135
|
+
elif self.runnable:
|
|
136
|
+
process_graph = self.runnable.process_graph
|
|
137
|
+
type = self.runnable.type
|
|
117
138
|
else:
|
|
118
|
-
|
|
139
|
+
process_graph = None
|
|
140
|
+
type = None
|
|
119
141
|
fairo_settings = {
|
|
120
142
|
"type": type,
|
|
121
143
|
"process_graph": process_graph,
|
|
122
144
|
}
|
|
123
145
|
if process_graph:
|
|
124
146
|
mlflow.log_text(json.dumps(fairo_settings, ensure_ascii=False, indent=2), artifact_file="fairo_settings.txt")
|
|
125
|
-
|
|
147
|
+
if self.agents:
|
|
148
|
+
save_process_graph()
|
|
126
149
|
try:
|
|
127
150
|
# Find environment variables used in the project
|
|
128
151
|
all_env_vars = read_variables()
|
|
@@ -133,30 +156,8 @@ class FairoExecutor:
|
|
|
133
156
|
except Exception as e:
|
|
134
157
|
logger.warning(f"Failed to log environment variables: {str(e)}")
|
|
135
158
|
|
|
136
|
-
|
|
137
|
-
ColSpec(type="string", name=first_input_key),
|
|
138
|
-
])
|
|
139
|
-
|
|
140
|
-
output_schema = Schema([
|
|
141
|
-
ColSpec(type="string", name=last_output_key),
|
|
142
|
-
])
|
|
143
|
-
model_info = mlflow.langchain.log_model(
|
|
144
|
-
pipeline,
|
|
145
|
-
artifact_path="",
|
|
146
|
-
signature=ModelSignature(inputs=input_schema, outputs=output_schema)
|
|
147
|
-
)
|
|
148
|
-
# If runnable object was added, check if it exists, if yes, just set tags for the trace, otherwise create it
|
|
159
|
+
# If runnable object was added, set runnable_id tag for the trace
|
|
149
160
|
if self.runnable:
|
|
150
|
-
if not self.runnable.id:
|
|
151
|
-
result = mlflow.register_model(
|
|
152
|
-
model_uri=model_info.model_uri,
|
|
153
|
-
name=self.runnable.name,
|
|
154
|
-
await_registration_for=0
|
|
155
|
-
)
|
|
156
|
-
self.runnable.create_version(
|
|
157
|
-
artifact_path=result.source,
|
|
158
|
-
registered_model_id=f"models:/{self.runnable.name}/{result.version}"
|
|
159
|
-
)
|
|
160
161
|
mlflow.set_tags({
|
|
161
162
|
"runnable_id": self.runnable.id,
|
|
162
163
|
"environment": "development",
|
|
@@ -172,12 +173,15 @@ class FairoExecutor:
|
|
|
172
173
|
Execute the pipeline using the provided input.
|
|
173
174
|
Properly handles and propagates errors from agents.
|
|
174
175
|
"""
|
|
175
|
-
|
|
176
|
+
if self.agents:
|
|
177
|
+
first_input_key = getattr(self.agents[0], 'input_key', 'input')
|
|
178
|
+
else:
|
|
179
|
+
first_input_key = 'input'
|
|
176
180
|
|
|
177
181
|
# Normalize input
|
|
178
182
|
if isinstance(input_data, str):
|
|
179
183
|
input_data = {first_input_key: input_data}
|
|
180
|
-
elif first_input_key not in input_data:
|
|
184
|
+
elif self.agents and (first_input_key not in input_data):
|
|
181
185
|
raise ValueError(f"Missing required input key: '{first_input_key}'")
|
|
182
186
|
|
|
183
187
|
if self.verbose:
|
|
@@ -7,14 +7,15 @@ from fairo.settings import get_fairo_base_url, get_fairo_api_key, get_fairo_api_
|
|
|
7
7
|
|
|
8
8
|
class Runnable:
|
|
9
9
|
def __init__(self,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
id: Optional[str] = None,
|
|
11
|
+
name: Optional[str] = None,
|
|
12
|
+
version: Optional[int] = None,
|
|
13
|
+
type: Optional[Literal["Agent", "Workflow", "Default"]] = None,
|
|
14
|
+
chain: Optional[List[Any]] = [],
|
|
14
15
|
agent: Optional[SimpleAgent] = None,
|
|
15
16
|
artifact_path: Optional[str] = None,
|
|
16
17
|
description: Optional[str] = ""):
|
|
17
|
-
self.id =
|
|
18
|
+
self.id = id
|
|
18
19
|
self.process_graph = None
|
|
19
20
|
self.name = name
|
|
20
21
|
self.version = version
|
|
@@ -34,14 +35,25 @@ class Runnable:
|
|
|
34
35
|
|
|
35
36
|
def load_version(self):
|
|
36
37
|
try:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
runnable_obj
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
if self.id:
|
|
39
|
+
runnable_obj = self.client.get(f"/runnables/{self.id}")
|
|
40
|
+
if runnable_obj:
|
|
41
|
+
self.artifact_path = runnable_obj.get('artifact_path')
|
|
42
|
+
self.type = runnable_obj.get('type')
|
|
43
|
+
self.description = runnable_obj.get('description')
|
|
44
|
+
self.id = runnable_obj.get('id')
|
|
45
|
+
self.process_graph = runnable_obj.get('process_graph')
|
|
46
|
+
elif self.name and self.version:
|
|
47
|
+
response = self.client.get(f"/runnables?version={self.version}&name={self.name}&page_size=1")
|
|
48
|
+
if len(response.get('results')) > 0:
|
|
49
|
+
runnable_obj = response.get('results')[0]
|
|
50
|
+
self.artifact_path = runnable_obj.get('artifact_path')
|
|
51
|
+
self.type = runnable_obj.get('type')
|
|
52
|
+
self.description = runnable_obj.get('description')
|
|
53
|
+
self.id = runnable_obj.get('id')
|
|
54
|
+
self.process_graph = runnable_obj.get('process_graph')
|
|
55
|
+
else:
|
|
56
|
+
response = None
|
|
45
57
|
except Exception as e:
|
|
46
58
|
print("Failed to check existing runnable version")
|
|
47
59
|
raise e
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fairo
|
|
3
|
-
Version: 25.6.
|
|
3
|
+
Version: 25.6.5
|
|
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,14 @@ 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
|
|
15
|
-
Requires-Dist: langchain
|
|
16
|
-
Requires-Dist: langchain-aws
|
|
17
|
-
Requires-Dist: langchain-community
|
|
18
|
-
Requires-Dist: langchain-core
|
|
19
|
-
Requires-Dist: langchain-text-splitters
|
|
20
|
-
Requires-Dist: psycopg2-binary
|
|
21
|
-
Requires-Dist: langchain-postgres
|
|
14
|
+
Requires-Dist: mlflow<3.0.0,>=2.21.0
|
|
15
|
+
Requires-Dist: langchain<0.4.0,>=0.3.20
|
|
16
|
+
Requires-Dist: langchain-aws<0.3.0,>=0.2.18
|
|
17
|
+
Requires-Dist: langchain-community<0.4.0,>=0.3.20
|
|
18
|
+
Requires-Dist: langchain-core<0.4.0,>=0.3.49
|
|
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
22
|
|
|
23
23
|
# Fairo SDK
|
|
24
24
|
|
|
@@ -20,14 +20,14 @@ classifiers = [
|
|
|
20
20
|
"Operating System :: OS Independent",
|
|
21
21
|
]
|
|
22
22
|
dependencies = [
|
|
23
|
-
"mlflow
|
|
24
|
-
"langchain
|
|
25
|
-
"langchain-aws
|
|
26
|
-
"langchain-community
|
|
27
|
-
"langchain-core
|
|
28
|
-
"langchain-text-splitters
|
|
29
|
-
"psycopg2-binary
|
|
30
|
-
"langchain-postgres
|
|
23
|
+
"mlflow>=2.21.0,<3.0.0",
|
|
24
|
+
"langchain>=0.3.20,<0.4.0",
|
|
25
|
+
"langchain-aws>=0.2.18,<0.3.0",
|
|
26
|
+
"langchain-community>=0.3.20,<0.4.0",
|
|
27
|
+
"langchain-core>=0.3.49,<0.4.0",
|
|
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
31
|
]
|
|
32
32
|
|
|
33
33
|
[tool.setuptools.packages.find]
|
fairo-25.6.2/fairo/__init__.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def extract_tag_release_id():
|
|
5
|
-
# Get the full reference from the environment variable
|
|
6
|
-
full_ref = os.getenv('GITHUB_REF')
|
|
7
|
-
|
|
8
|
-
# Check if the GITHUB_REF is set and it's a tag
|
|
9
|
-
if full_ref and full_ref.startswith('refs/tags/'):
|
|
10
|
-
# Extract the tag name
|
|
11
|
-
tag_name = full_ref.split('/')[-1]
|
|
12
|
-
return tag_name.replace('release-v', '')
|
|
13
|
-
else:
|
|
14
|
-
return "0.1"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__version__ = extract_tag_release_id()
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|