Praxos-python 0.3.3__tar.gz → 0.4.0__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.
@@ -174,6 +174,4 @@ cython_debug/
174
174
  .pypirc
175
175
 
176
176
  .vscode/
177
- tests/*
178
- src/.DS_Store
179
- */.DS_Store
177
+ tests/*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Praxos-python
3
- Version: 0.3.3
3
+ Version: 0.4.0
4
4
  Summary: Python SDK for Praxos with Intelligent Search
5
5
  Author-email: Masoud Kermani Poor <masoud@praxos.ai>, Soheil Sadabadi <soheil@praxos.ai>
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Praxos-python"
3
- version = "0.3.3"
3
+ version = "0.4.0"
4
4
  description = "Python SDK for Praxos with Intelligent Search"
5
5
  authors = [{ name = "Masoud Kermani Poor", email = "masoud@praxos.ai" }, {name = "Soheil Sadabadi", email = "soheil@praxos.ai"}]
6
6
  readme = "README.md"
@@ -156,6 +156,34 @@ class SyncClient:
156
156
  response_data = self._request("GET", "ontology")
157
157
  return [SyncOntology(client=self, **ontology) for ontology in response_data]
158
158
 
159
+ def search_types(self, description: str, environment_id: str, limit: Optional[int] = None, kind: Optional[str] = None) -> Dict[str, Any]:
160
+ """
161
+ Searches for types based on a description.
162
+
163
+ Args:
164
+ description: A natural language description of the type.
165
+ environment_id: The ID of the environment to search in.
166
+ limit: The maximum number of results to return.
167
+ kind: The kind of type to search for ('entity' or 'literal').
168
+
169
+ Returns:
170
+ A dictionary containing the search results.
171
+ """
172
+ if not description:
173
+ raise ValueError("Description is required")
174
+ if not environment_id:
175
+ raise ValueError("Environment ID is required")
176
+
177
+ json_data = {
178
+ "description": description,
179
+ "environment_id": environment_id,
180
+ }
181
+ if limit:
182
+ json_data["limit"] = limit
183
+ if kind:
184
+ json_data["kind"] = kind
185
+
186
+ return self._request("POST", "search/type", json_data=json_data)
159
187
 
160
188
  def close(self) -> None:
161
189
  """Closes the underlying httpx client."""
@@ -715,3 +715,45 @@ class SyncEnvironment(BaseEnvironmentAttributes):
715
715
  response_data = self._client._request("GET", f"/sources", params={"environment_id": self.id, "name": name})
716
716
 
717
717
  return SyncSource(client=self._client, **response_data)
718
+
719
+ def ingest_trigger(self, text: str) -> Dict[str, Any]:
720
+ """
721
+ Ingests a natural language trigger into the system for this environment.
722
+
723
+ Args:
724
+ text: The natural language text of the trigger.
725
+
726
+ Returns:
727
+ A dictionary containing the ingestion status response.
728
+ """
729
+ if not text:
730
+ raise ValueError("Trigger text is required")
731
+
732
+ json_data = {
733
+ "text": text,
734
+ "environment_id": self.id,
735
+ }
736
+ return self._client._request("POST", "ingest-trigger", json_data=json_data)
737
+
738
+ def evaluate_event(self, event_json: Dict, provider: str) -> Dict[str, Any]:
739
+ """
740
+ Evaluates an incoming event against the rules in this environment.
741
+
742
+ Args:
743
+ event_json: The event payload as a dictionary.
744
+ provider: The source provider of the event (e.g., 'gmail', 'outlook').
745
+
746
+ Returns:
747
+ A dictionary containing the evaluation results, including any fired rules.
748
+ """
749
+ if not event_json:
750
+ raise ValueError("Event JSON is required")
751
+ if not provider:
752
+ raise ValueError("Provider is required")
753
+
754
+ json_data = {
755
+ "event_json": event_json,
756
+ "environment_id": self.id,
757
+ "provider": provider,
758
+ }
759
+ return self._client._request("POST", "evaluate-event", json_data=json_data)
@@ -1,113 +0,0 @@
1
- """
2
- Test script to verify intelligent search functionality in the installed SDK
3
- """
4
-
5
- def test_intelligent_search_import():
6
- """Test that we can import and use the new search methods"""
7
- try:
8
- from praxos_python import SyncClient
9
-
10
- # Check if the new methods exist
11
- client = SyncClient(api_key="test_key", base_url="http://localhost")
12
-
13
- # Verify search method exists
14
- assert hasattr(client, 'search'), "search method not found"
15
- assert hasattr(client, 'intelligent_search'), "intelligent_search method not found"
16
-
17
- print("✅ Import successful - intelligent search methods available")
18
-
19
- # Check method signatures
20
- import inspect
21
- search_sig = inspect.signature(client.search)
22
- intel_sig = inspect.signature(client.intelligent_search)
23
-
24
- print(f"✅ search() method signature: {len(search_sig.parameters)} parameters")
25
- print(f"✅ intelligent_search() method signature: {len(intel_sig.parameters)} parameters")
26
-
27
- # Check that intelligent is default modality
28
- search_params = search_sig.parameters
29
- if 'search_modality' in search_params:
30
- default_modality = search_params['search_modality'].default
31
- print(f"✅ Default search modality: {default_modality}")
32
-
33
- return True
34
-
35
- except ImportError as e:
36
- print(f"❌ Import failed: {e}")
37
- return False
38
- except Exception as e:
39
- print(f"❌ Unexpected error: {e}")
40
- return False
41
-
42
- def test_search_parameters():
43
- """Test that all expected search parameters are available"""
44
- try:
45
- from praxos_python import SyncClient
46
- import inspect
47
-
48
- client = SyncClient(api_key="test_key", base_url="http://localhost")
49
- search_sig = inspect.signature(client.search)
50
-
51
- expected_params = [
52
- 'query', 'environment_id', 'search_modality', 'top_k',
53
- 'node_type', 'node_label', 'node_kind', 'temporal_filter',
54
- 'known_anchors', 'target_type', 'source_type' # Legacy params
55
- ]
56
-
57
- available_params = list(search_sig.parameters.keys())
58
-
59
- missing_params = []
60
- for param in expected_params:
61
- if param not in available_params:
62
- missing_params.append(param)
63
-
64
- if missing_params:
65
- print(f"❌ Missing parameters: {missing_params}")
66
- return False
67
- else:
68
- print(f"✅ All expected parameters available: {len(available_params)} total")
69
- return True
70
-
71
- except Exception as e:
72
- print(f"❌ Parameter test failed: {e}")
73
- return False
74
-
75
- if __name__ == "__main__":
76
- print("Testing Praxos Python SDK v0.3.0 with Intelligent Search")
77
- print("=" * 60)
78
-
79
- success = True
80
-
81
- # Test imports
82
- success &= test_intelligent_search_import()
83
- print()
84
-
85
- # Test parameters
86
- success &= test_search_parameters()
87
- print()
88
-
89
- if success:
90
- print("🎉 All tests passed! SDK is ready to use.")
91
- print("\nExample usage:")
92
- print("""
93
- from praxos_python import SyncClient
94
-
95
- client = SyncClient(api_key="your_api_key")
96
-
97
- # Intelligent search
98
- results = client.intelligent_search(
99
- query="financial transactions in November 2023",
100
- environment_id="your_env_id"
101
- )
102
-
103
- # Advanced search
104
- results = client.search(
105
- query="withdrawal amounts from TD Bank",
106
- environment_id="your_env_id",
107
- search_modality="intelligent",
108
- top_k=20,
109
- include_graph_context=True
110
- )
111
- """)
112
- else:
113
- print("❌ Some tests failed. Check installation and try again.")
File without changes
File without changes
File without changes