naas-abi 1.0.11__py3-none-any.whl → 1.0.13__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.
@@ -0,0 +1,589 @@
1
+ Metadata-Version: 2.4
2
+ Name: naas-abi
3
+ Version: 1.0.13
4
+ Summary: Multi-agent orchestrator and knowledge graph management system for AI orchestration, providing comprehensive coordination of specialized AI agents and semantic data management capabilities
5
+ Author-email: Maxime Jublou <maxime@naas.ai>, Florent Ravenel <florent@naas.ai>, Jeremy Ravenel <jeremy@naas.ai>
6
+ License: MIT License
7
+ Project-URL: Homepage, https://github.com/jupyter-naas/abi
8
+ Project-URL: Repository, https://github.com/jupyter-naas/abi/tree/main/libs/naas-abi
9
+ Requires-Python: <4,>=3.10
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: naas-abi-core>=1.4.0
12
+ Requires-Dist: naas-abi-marketplace>=1.3.3
13
+ Requires-Dist: thefuzz>=0.22.1
14
+
15
+ # naas-abi
16
+
17
+ Multi-agent orchestrator and knowledge graph management system for AI orchestration, providing comprehensive coordination of specialized AI agents and semantic data management capabilities.
18
+
19
+ ## Overview
20
+
21
+ `naas-abi` is the central coordination hub for the ABI (Agentic Brain Infrastructure) ecosystem. It provides:
22
+
23
+ - **Multi-Agent Orchestration**: Central coordinator managing specialized AI agents (ChatGPT, Claude, Mistral, Gemini, Grok, Llama, Perplexity, Qwen, DeepSeek, Gemma)
24
+ - **Knowledge Graph Operations**: Complete CRUD operations for semantic data management
25
+ - **Ontology Engineering**: BFO-compliant entity extraction and SPARQL generation
26
+ - **Intelligent Routing**: Weighted decision hierarchy with context preservation
27
+ - **Multilingual Support**: Native French/English interactions with cultural awareness
28
+ - **Production Integration**: Event-driven triggers and YAML ontology publishing
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install naas-abi
34
+ ```
35
+
36
+ ## Core Components
37
+
38
+ ### ABIModule
39
+
40
+ The `ABIModule` is the main module that orchestrates the entire ABI system. It automatically loads marketplace modules (AI agents, applications, domain experts) and provides the core infrastructure.
41
+
42
+ **Configuration:**
43
+
44
+ ```yaml
45
+ modules:
46
+ - module: naas_abi
47
+ enabled: true
48
+ config:
49
+ datastore_path: "abi"
50
+ workspace_id: "{{ secret.WORKSPACE_ID }}"
51
+ storage_name: "{{ secret.STORAGE_NAME }}"
52
+ ```
53
+
54
+ **Dependencies:**
55
+
56
+ The module automatically loads marketplace modules as soft dependencies (optional):
57
+ - AI Agents: ChatGPT, Claude, Mistral, Gemini, Grok, Llama, Perplexity, Qwen, DeepSeek, Gemma
58
+ - Applications: GitHub, LinkedIn, Google services, and 50+ other integrations
59
+ - Domain Experts: Support, Software Engineering, Data Analysis, and more
60
+
61
+ **Required Services:**
62
+ - `Secret`: For credential management
63
+ - `TripleStoreService`: For knowledge graph operations
64
+ - `ObjectStorageService`: For file storage
65
+
66
+ ### Agents
67
+
68
+ #### AbiAgent
69
+
70
+ The main multi-agent orchestrator that coordinates specialized agents.
71
+
72
+ **Features:**
73
+ - Intelligent routing based on request type and context
74
+ - Context preservation across conversations
75
+ - Multilingual support (French/English)
76
+ - Weighted decision hierarchy for optimal agent selection
77
+ - Strategic advisory capabilities
78
+
79
+ **Usage:**
80
+
81
+ ```python
82
+ from naas_abi.agents.AbiAgent import create_agent
83
+
84
+ agent = create_agent()
85
+ response = agent.invoke("Route this to the best AI for code generation")
86
+ ```
87
+
88
+ **Routing Priorities:**
89
+ - Context Preservation (0.99): Maintains active conversations
90
+ - Identity/Strategic (0.95): Direct Abi responses
91
+ - Web Search (0.90): Routes to Perplexity/ChatGPT
92
+ - Creative/Multimodal (0.85): Routes to Gemini
93
+ - Truth Seeking (0.80): Routes to Grok
94
+ - Advanced Reasoning (0.75): Routes to Claude
95
+ - Code & Math (0.70): Routes to Mistral
96
+ - Knowledge Graph (0.68): Opens KG Explorer
97
+ - Internal Knowledge (0.65): Uses ontology agent
98
+ - Platform Operations (0.45): Routes to Naas agent
99
+ - Issue Management (0.25): Routes to Support agent
100
+
101
+ #### EntitytoSPARQLAgent
102
+
103
+ Extracts entities from natural language and generates SPARQL queries.
104
+
105
+ **Capabilities:**
106
+ - BFO-compliant entity extraction
107
+ - Automatic SPARQL query generation
108
+ - Entity relationship mapping
109
+ - Ontology-aware query construction
110
+
111
+ **Usage:**
112
+
113
+ ```python
114
+ from naas_abi.agents.EntitytoSPARQLAgent import create_agent
115
+
116
+ agent = create_agent()
117
+ response = agent.invoke(
118
+ "Extract entities from: 'John works at Microsoft as a software engineer'"
119
+ )
120
+ ```
121
+
122
+ #### KnowledgeGraphBuilderAgent
123
+
124
+ Provides complete CRUD operations for the knowledge graph.
125
+
126
+ **Capabilities:**
127
+ - Add individuals (entities) to the knowledge graph
128
+ - Update properties and relationships
129
+ - Remove individuals
130
+ - Merge duplicate entities
131
+ - Query and explore the graph
132
+
133
+ **Usage:**
134
+
135
+ ```python
136
+ from naas_abi.agents.KnowledgeGraphBuilderAgent import create_agent
137
+
138
+ agent = create_agent()
139
+ response = agent.invoke(
140
+ "Add a new organization called 'NaasAI' to the knowledge graph"
141
+ )
142
+ ```
143
+
144
+ #### OntologyEngineerAgent
145
+
146
+ Specialized agent for BFO ontology engineering and management.
147
+
148
+ **Capabilities:**
149
+ - Ontology creation and modification
150
+ - BFO-compliant structure validation
151
+ - Class and property definition
152
+ - Ontology publishing to YAML
153
+
154
+ **Usage:**
155
+
156
+ ```python
157
+ from naas_abi.agents.OntologyEngineerAgent import create_agent
158
+
159
+ agent = create_agent()
160
+ response = agent.invoke(
161
+ "Create a new ontology class for 'SoftwareProject' with properties"
162
+ )
163
+ ```
164
+
165
+ ### Workflows
166
+
167
+ #### AgentRecommendationWorkflow
168
+
169
+ Recommends the best AI agent for a given intent using SPARQL queries.
170
+
171
+ **Features:**
172
+ - Intent-to-query matching
173
+ - SPARQL template parameterization
174
+ - Weighted recommendation scoring
175
+ - Provider preference support
176
+
177
+ **Usage:**
178
+
179
+ ```python
180
+ from naas_abi.workflows.AgentRecommendationWorkflow import (
181
+ AgentRecommendationWorkflow,
182
+ AgentRecommendationConfiguration,
183
+ AgentRecommendationParameters
184
+ )
185
+
186
+ workflow = AgentRecommendationWorkflow(
187
+ AgentRecommendationConfiguration(queries_file_path="path/to/queries.ttl")
188
+ )
189
+
190
+ result = workflow.run(AgentRecommendationParameters(
191
+ intent_description="I need help with code generation",
192
+ provider_preference="openai"
193
+ ))
194
+ ```
195
+
196
+ #### ArtificialAnalysisWorkflow
197
+
198
+ Fetches and stores AI model data from the Artificial Analysis API.
199
+
200
+ **Features:**
201
+ - Fetches model performance data
202
+ - Filters for modules with active agents
203
+ - Saves timestamped JSON files
204
+ - Supports multiple endpoints (models, providers, categories)
205
+
206
+ **Usage:**
207
+
208
+ ```python
209
+ from naas_abi.workflows.ArtificialAnalysisWorkflow import (
210
+ ArtificialAnalysisWorkflow,
211
+ ArtificialAnalysisWorkflowConfiguration,
212
+ ArtificialAnalysisWorkflowParameters
213
+ )
214
+
215
+ workflow = ArtificialAnalysisWorkflow(
216
+ ArtificialAnalysisWorkflowConfiguration(
217
+ api_key="your_api_key",
218
+ base_url="https://artificialanalysis.ai/api/v2"
219
+ )
220
+ )
221
+
222
+ result = workflow.run(ArtificialAnalysisWorkflowParameters(
223
+ endpoint="models",
224
+ validate_agents_only=True
225
+ ))
226
+ ```
227
+
228
+ #### SearchIndividualWorkflow
229
+
230
+ Searches for individuals (entities) in the knowledge graph.
231
+
232
+ **Features:**
233
+ - Semantic search across entities
234
+ - Fuzzy matching support
235
+ - Property-based filtering
236
+ - Result ranking
237
+
238
+ #### GetSubjectGraphWorkflow
239
+
240
+ Retrieves the graph structure for a specific subject (entity).
241
+
242
+ **Features:**
243
+ - Entity relationship exploration
244
+ - Configurable depth traversal
245
+ - Graph visualization data
246
+ - Property and relationship extraction
247
+
248
+ #### GetObjectPropertiesFromClassWorkflow
249
+
250
+ Retrieves object properties for a given ontology class.
251
+
252
+ **Features:**
253
+ - Class property discovery
254
+ - BFO-compliant property extraction
255
+ - Relationship type identification
256
+ - Ontology hierarchy traversal
257
+
258
+ ### Pipelines
259
+
260
+ #### AddIndividualPipeline
261
+
262
+ Adds new individuals (entities) to the knowledge graph.
263
+
264
+ **Features:**
265
+ - Duplicate detection
266
+ - Automatic URI generation
267
+ - Property assignment
268
+ - Relationship creation
269
+
270
+ #### AIAgentOntologyGenerationPipeline
271
+
272
+ Generates AI agent ontologies from Artificial Analysis data.
273
+
274
+ **Features:**
275
+ - BFO-structured ontology generation
276
+ - Model-to-agent mapping
277
+ - Timestamped audit trails
278
+ - Automatic deployment to module folders
279
+
280
+ **Execution Steps:**
281
+ 1. Loads Artificial Analysis data
282
+ 2. Groups models by AI agent
283
+ 3. Generates ontologies in timestamped folders
284
+ 4. Deploys current versions to module folders
285
+ 5. Creates audit trail and summary
286
+
287
+ #### InsertDataSPARQLPipeline
288
+
289
+ Inserts data into the knowledge graph using SPARQL INSERT queries.
290
+
291
+ **Features:**
292
+ - SPARQL query execution
293
+ - Batch insert operations
294
+ - Validation and error handling
295
+ - Transaction support
296
+
297
+ #### MergeIndividualsPipeline
298
+
299
+ Merges duplicate individuals in the knowledge graph.
300
+
301
+ **Features:**
302
+ - Duplicate detection
303
+ - Property merging
304
+ - Relationship consolidation
305
+ - Audit logging
306
+
307
+ #### RemoveIndividualPipeline
308
+
309
+ Removes individuals from the knowledge graph.
310
+
311
+ **Features:**
312
+ - Safe deletion with validation
313
+ - Relationship cleanup
314
+ - Audit trail creation
315
+ - Backup generation
316
+
317
+ #### Update Pipelines
318
+
319
+ Specialized pipelines for updating specific entity types:
320
+ - `UpdateDataPropertyPipeline`: Updates data properties
321
+ - `UpdatePersonPipeline`: Updates person entities
322
+ - `UpdateCommercialOrganizationPipeline`: Updates organization entities
323
+ - `UpdateSkillPipeline`: Updates skill entities
324
+ - `UpdateLinkedInPagePipeline`: Updates LinkedIn page data
325
+ - `UpdateTickerPipeline`: Updates stock ticker information
326
+ - `UpdateWebsitePipeline`: Updates website information
327
+ - `UpdateLegalNamePipeline`: Updates legal names
328
+
329
+ ### Ontologies
330
+
331
+ The module includes a comprehensive ontology structure organized in a 4-level hierarchy:
332
+
333
+ 1. **Top-level**: BFO foundational ontologies
334
+ 2. **Mid-level**: Common Core Ontologies (CCO)
335
+ 3. **Domain-level**: Domain-specific ontologies
336
+ 4. **Application-level**: Use-case specific ontologies
337
+
338
+ **Location:** `naas_abi/ontologies/`
339
+
340
+ ### Models
341
+
342
+ The module supports multiple AI model configurations:
343
+
344
+ #### Cloud Mode (Default)
345
+ - **Model**: `gpt-4.1-mini`
346
+ - **Provider**: OpenAI
347
+ - **Temperature**: 0 (precise orchestration)
348
+ - **Requires**: `OPENAI_API_KEY`
349
+
350
+ #### Airgap Mode
351
+ - **Qwen3** (default): Temperature 0.7, 8K context
352
+ - **Gemma3** (alternative): Temperature 0.2, 8K context
353
+ - **Requires**: Docker Model Runner on `localhost:12434`
354
+
355
+ **Configuration:**
356
+
357
+ ```python
358
+ # Set environment variable
359
+ AI_MODE=cloud # or "airgap" or "local"
360
+ ```
361
+
362
+ ## CLI Tools
363
+
364
+ The module provides CLI commands for creating new components:
365
+
366
+ ```bash
367
+ # Create a new module
368
+ python -m naas_abi.cli create-module
369
+
370
+ # Create a new agent
371
+ python -m naas_abi.cli create-agent
372
+
373
+ # Create a new integration
374
+ python -m naas_abi.cli create-integration
375
+
376
+ # Create a new workflow
377
+ python -m naas_abi.cli create-workflow
378
+
379
+ # Create a new pipeline
380
+ python -m naas_abi.cli create-pipeline
381
+
382
+ # Create a new ontology
383
+ python -m naas_abi.cli create-ontology
384
+ ```
385
+
386
+ Each command provides an interactive wizard to guide you through the creation process.
387
+
388
+ ## Usage Examples
389
+
390
+ ### Basic Agent Interaction
391
+
392
+ ```python
393
+ from naas_abi_core.engine.Engine import Engine
394
+
395
+ # Initialize engine
396
+ engine = Engine()
397
+ engine.load(module_names=["naas_abi"])
398
+
399
+ # Get AbiAgent
400
+ from naas_abi.agents.AbiAgent import create_agent
401
+
402
+ agent = create_agent()
403
+
404
+ # Interact with agent
405
+ response = agent.invoke("What agents are available?")
406
+ print(response)
407
+ ```
408
+
409
+ ### Knowledge Graph Operations
410
+
411
+ ```python
412
+ from naas_abi.agents.KnowledgeGraphBuilderAgent import create_agent
413
+
414
+ kg_agent = create_agent()
415
+
416
+ # Add an organization
417
+ kg_agent.invoke("Add organization 'NaasAI' with website 'https://naas.ai'")
418
+
419
+ # Search for entities
420
+ from naas_abi.workflows.SearchIndividualWorkflow import (
421
+ SearchIndividualWorkflow,
422
+ SearchIndividualWorkflowConfiguration,
423
+ SearchIndividualWorkflowParameters
424
+ )
425
+
426
+ workflow = SearchIndividualWorkflow(
427
+ SearchIndividualWorkflowConfiguration(
428
+ triple_store=engine.services.triple_store
429
+ )
430
+ )
431
+
432
+ results = workflow.run(SearchIndividualWorkflowParameters(
433
+ search_term="NaasAI"
434
+ ))
435
+ ```
436
+
437
+ ### Workflow Execution
438
+
439
+ ```python
440
+ from naas_abi.workflows.AgentRecommendationWorkflow import (
441
+ AgentRecommendationWorkflow,
442
+ AgentRecommendationConfiguration,
443
+ AgentRecommendationParameters
444
+ )
445
+
446
+ workflow = AgentRecommendationWorkflow(
447
+ AgentRecommendationConfiguration(
448
+ queries_file_path="path/to/queries.ttl"
449
+ )
450
+ )
451
+
452
+ recommendations = workflow.run(AgentRecommendationParameters(
453
+ intent_description="I need help with data analysis",
454
+ provider_preference="anthropic"
455
+ ))
456
+ ```
457
+
458
+ ### Pipeline Execution
459
+
460
+ ```python
461
+ from naas_abi.pipelines.AddIndividualPipeline import (
462
+ AddIndividualPipeline,
463
+ AddIndividualPipelineConfiguration,
464
+ AddIndividualPipelineParameters
465
+ )
466
+
467
+ pipeline = AddIndividualPipeline(
468
+ AddIndividualPipelineConfiguration(
469
+ triple_store=engine.services.triple_store,
470
+ search_individual_configuration=SearchIndividualWorkflowConfiguration(
471
+ triple_store=engine.services.triple_store
472
+ )
473
+ )
474
+ )
475
+
476
+ graph = pipeline.run(AddIndividualPipelineParameters(
477
+ individual_label="New Company",
478
+ individual_type="CommercialOrganization"
479
+ ))
480
+ ```
481
+
482
+ ## Configuration
483
+
484
+ ### Environment Variables
485
+
486
+ | Variable | Values | Default | Description |
487
+ |----------|--------|---------|-------------|
488
+ | `AI_MODE` | `cloud` \| `airgap` \| `local` | `cloud` | Model deployment mode |
489
+ | `OPENAI_API_KEY` | API key | Required (cloud) | For cloud models |
490
+ | `NAAS_API_KEY` | API key | Optional | For production triggers |
491
+ | `ENV` | `dev` \| `prod` | `dev` | Environment mode |
492
+
493
+ ### Module Configuration
494
+
495
+ ```yaml
496
+ modules:
497
+ - module: naas_abi
498
+ enabled: true
499
+ config:
500
+ datastore_path: "abi"
501
+ workspace_id: "{{ secret.WORKSPACE_ID }}"
502
+ storage_name: "{{ secret.STORAGE_NAME }}"
503
+ ```
504
+
505
+ ## Key Features
506
+
507
+ ### 🔄 Context-Aware Orchestration
508
+ Preserves active conversations while enabling intelligent agent transitions.
509
+
510
+ ### 🌍 Multilingual Support
511
+ Native French/English code-switching with cultural awareness.
512
+
513
+ ### 🎯 Weighted Decision Routing
514
+ Sophisticated hierarchy for optimal agent selection based on request type.
515
+
516
+ ### 🔍 Knowledge Graph Integration
517
+ Direct access to SPARQL querying and semantic data exploration.
518
+
519
+ ### 🔒 Deployment Flexibility
520
+ Choice between cloud (OpenAI) and airgap (Docker Model Runner) models.
521
+
522
+ ### 📊 Strategic Advisory
523
+ Direct consultation capabilities for business and technical guidance.
524
+
525
+ ### 🛡️ Production Ready
526
+ Event-driven triggers, comprehensive testing, and error resilience.
527
+
528
+ ## Dependencies
529
+
530
+ - `naas-abi-core>=1.0.0`: Core ABI framework
531
+ - `naas-abi-marketplace>=1.0.0`: Marketplace modules and agents
532
+ - `thefuzz>=0.22.1`: Fuzzy string matching
533
+
534
+ ## Architecture
535
+
536
+ ### Module Structure
537
+
538
+ ```
539
+ naas_abi/
540
+ ├── agents/ # Agent implementations
541
+ │ ├── AbiAgent.py
542
+ │ ├── EntitytoSPARQLAgent.py
543
+ │ ├── KnowledgeGraphBuilderAgent.py
544
+ │ └── OntologyEngineerAgent.py
545
+ ├── workflows/ # Business logic workflows
546
+ │ ├── AgentRecommendationWorkflow.py
547
+ │ ├── ArtificialAnalysisWorkflow.py
548
+ │ ├── SearchIndividualWorkflow.py
549
+ │ ├── GetSubjectGraphWorkflow.py
550
+ │ └── GetObjectPropertiesFromClassWorkflow.py
551
+ ├── pipelines/ # Data processing pipelines
552
+ │ ├── AddIndividualPipeline.py
553
+ │ ├── AIAgentOntologyGenerationPipeline.py
554
+ │ ├── InsertDataSPARQLPipeline.py
555
+ │ ├── MergeIndividualsPipeline.py
556
+ │ └── Update*Pipeline.py
557
+ ├── ontologies/ # Ontology definitions
558
+ ├── models/ # Model configurations
559
+ ├── cli.py # CLI commands
560
+ └── __init__.py # Module initialization
561
+ ```
562
+
563
+ ## Testing
564
+
565
+ ```bash
566
+ # Run all tests
567
+ pytest naas_abi/ -v
568
+
569
+ # Test specific agent
570
+ pytest naas_abi/agents/AbiAgent_test.py -v
571
+
572
+ # Test workflows
573
+ pytest naas_abi/workflows/ -v
574
+
575
+ # Test pipelines
576
+ pytest naas_abi/pipelines/ -v
577
+ ```
578
+
579
+ ## See Also
580
+
581
+ - [ABI Main README](../../README.md) - Complete ABI framework documentation
582
+ - [naas-abi-core](../naas-abi-core/) - Core engine documentation
583
+ - [naas-abi-cli](../naas-abi-cli/) - CLI tool documentation
584
+ - [naas-abi-marketplace](../naas-abi-marketplace/) - Marketplace modules
585
+
586
+ ## License
587
+
588
+ MIT License
589
+
@@ -43,7 +43,7 @@ naas_abi/workflows/GetSubjectGraphWorkflow.py,sha256=EkgrFQPyaUVeC8sd7oVcxT9LUka
43
43
  naas_abi/workflows/GetSubjectGraphWorkflow_test.py,sha256=5B2r3QsdBIKwYOuHkEhnfEPKV6xpWZzwRQyhBintgpo,2067
44
44
  naas_abi/workflows/SearchIndividualWorkflow.py,sha256=6vWwywKNBlaosopPxiw0OpQnrn99wuiji0uA7jwKOn4,6572
45
45
  naas_abi/workflows/SearchIndividualWorkflow_test.py,sha256=ySEgDQFEbevAxkjX9W8No-7JG9A6bH6Y8bCi86aenVA,2762
46
- naas_abi-1.0.11.dist-info/METADATA,sha256=FaaD3Hr_47TTDTLqiOENE2Mb_atlJElQYhj4Rf80nq4,553
47
- naas_abi-1.0.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- naas_abi-1.0.11.dist-info/top_level.txt,sha256=Dhf3mhATB9-JuvBR8Y55OabvI-PCeQUqb5ae3EMmbeA,9
49
- naas_abi-1.0.11.dist-info/RECORD,,
46
+ naas_abi-1.0.13.dist-info/METADATA,sha256=95Wx0RjSoyRfRwwYaYXA9Xxo29DKnTVYbxQcPNSLj60,15812
47
+ naas_abi-1.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
+ naas_abi-1.0.13.dist-info/top_level.txt,sha256=Dhf3mhATB9-JuvBR8Y55OabvI-PCeQUqb5ae3EMmbeA,9
49
+ naas_abi-1.0.13.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: naas-abi
3
- Version: 1.0.11
4
- Summary: Multi-agent orchestrator and knowledge graph management system for AI orchestration, providing comprehensive coordination of specialized AI agents and semantic data management capabilities
5
- Author-email: Maxime Jublou <maxime@naas.ai>, Florent Ravenel <florent@naas.ai>, Jeremy Ravenel <jeremy@naas.ai>
6
- Requires-Python: <4,>=3.10
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: naas-abi-core>=1.0.0-dev.1
9
- Requires-Dist: naas-abi-marketplace>=1.0.0-dev.1
10
- Requires-Dist: thefuzz>=0.22.1