Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ make run-busnode OPTIONS="--service=<SERVICE_NAME> --endpoint=<ENDPOINT> --ports
```

### Examples
#### AtomDB
```
make run-busnode OPTIONS="--service=atomdb-broker --endpoint=localhost:8888 --ports-range=25000:26000"
```

#### Query Engine
```
make run-busnode OPTIONS="--service=query-engine --endpoint=localhost:9000 --ports-range=3000:3100 --attention-broker-endpoint=localhost:37007"
Expand All @@ -56,7 +53,10 @@ make run-busnode OPTIONS="--service=link-creation-agent --endpoint=localhost:900
```
make run-busnode OPTIONS="--service=inference-agent --endpoint=localhost:9003 --ports-range=5000:5100 --attention-broker-endpoint=localhost:37007 --bus-endpoint=localhost:9000"
```

#### AtomDB
```
make run-busnode OPTIONS="--service=atomdb-broker --endpoint=localhost:9004 --ports-range=25000:26000 --bus-endpoint=localhost:9000"
```

## Running Client

Expand All @@ -71,25 +71,35 @@ make run-client OPTIONS="--service=<SERVICE_NAME> --endpoint=<ENDPOINT> --bus-en
### Examples
#### AtomDB:
```
make run-client OPTIONS="--service=atomdb-broker --endpoint=localhost:8887 --bus-endpoint=localhost:8888 --ports-range=27000:28000 --action=add_atoms --tokens=LINK Expression 2 NODE Symbol A NODE Symbol B"
make run-client OPTIONS="--service=atomdb-broker --endpoint=localhost:8887 --bus-endpoint=localhost:9000 --ports-range=27000:28000 --action=add_atoms --tokens=LINK Expression 2 NODE Symbol A NODE Symbol B"
```
#### Query Engine:
```
make run-client OPTIONS="--service=query-engine --endpoint=localhost:8085 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --query=LINK_TEMPLATE Expression 2 NODE Symbol Predicate VARIABLE V1 --context=test --populate-metta-mapping"
```
#### LCA:
```
make run-client OPTIONS="--service=link-creation-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9002 --ports-range=41000:41999 --use-metta-as-query-tokens --max-answers=5 --request='(and (Concept %C1) (Concept %C2)) EQUIVALENCE_RELATION'"
make run-client OPTIONS="--service=link-creation-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --use-metta-as-query-tokens --max-answers=5 --request='(and (Concept %C1) (Concept %C2)) EQUIVALENCE_RELATION'"
```
or
```
make run-client OPTIONS="--service=link-creation-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9002 --ports-range=41000:41999 --max-answers=5 --request=AND 2 LINK_TEMPLATE Expression 2 NODE Symbol PREDICATE VARIABLE P1 LINK_TEMPLATE Expression 2 NODE Symbol PREDICATE VARIABLE P2 LINK_CREATE Similarity3 2 0 VARIABLE P1 VARIABLE P2"
make run-client OPTIONS="--service=link-creation-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --max-answers=5 --request=AND 2 LINK_TEMPLATE Expression 2 NODE Symbol PREDICATE VARIABLE P1 LINK_TEMPLATE Expression 2 NODE Symbol PREDICATE VARIABLE P2 LINK_CREATE Similarity3 2 0 VARIABLE P1 VARIABLE P2"
```
#### Inference Agent
```
make run-client OPTIONS="--service=inference-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9003 --ports-range=41000:41999 --max-answers=5 --request=PROOF_OF_IMPLICATION 2d01b94c549678aa84840e5901f8d449 ba8267a5c1411eb4bc32d9062e3398ad 2 TOY"
make run-client OPTIONS="--service=inference-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --max-answers=5 --request=PROOF_OF_IMPLICATION 2d01b94c549678aa84840e5901f8d449 ba8267a5c1411eb4bc32d9062e3398ad 2 TOY"
```

#### Context Broker
```
make run-client OPTIONS="--service=context-broker --endpoint=localhost:8086 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --query=OR 3 AND 4 LINK_TEMPLATE Expression 3 NODE Symbol Evaluation VARIABLE V0 LINK_TEMPLATE Expression 2 NODE Symbol Concept VARIABLE S1 LINK_TEMPLATE Expression 3 NODE Symbol Contains VARIABLE S1 VARIABLE W1 LINK_TEMPLATE Expression 3 NODE Symbol Contains VARIABLE S2 VARIABLE W1 LINK_TEMPLATE Expression 3 NODE Symbol Evaluation VARIABLE V1 LINK_TEMPLATE Expression 2 NODE Symbol Concept VARIABLE S2 LINK_TEMPLATE Expression 3 NODE Symbol Implication VARIABLE V0 VARIABLE V1 LINK_TEMPLATE Expression 3 NODE Symbol Implication VARIABLE V1 VARIABLE V0 --determiner-schema=V0:V1,V0:S2 --stimulus-schema=V0"
```

#### Evolution Agent

```
make run-client OPTIONS="--service=evolution-agent --endpoint=localhost:8085 --bus-endpoint=localhost:9000 --ports-range=41000:41999 --query='(Contains %sentence1 (Word \"bbb\"))' --correlation-queries='(Contains %placeholder1 %word1)' --correlation-replacements=%placeholder1:sentence1 --correlation-mappings=sentence1:%word1 --max-generations=3 --fitness-function-tag=count_letter --context=Aaa --use-metta-as-query-tokens --max-answers=50"
```

## Adding a New Element

Expand Down
6 changes: 6 additions & 0 deletions src/main/bus_client.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <signal.h>

#include "FitnessFunctionRegistry.h"
#include "Helper.h"
#include "Logger.h"
#include "Properties.h"
Expand Down Expand Up @@ -51,6 +52,11 @@ int main(int argc, char* argv[]) {
} else {
AtomDBSingleton::init();
}
if (Helper::processor_type_from_string(cmd_args[Helper::SERVICE]) ==
mains::ProcessorType::EVOLUTION_AGENT) {
LOG_INFO("Initializing Fitness Function Registry statics...");
FitnessFunctionRegistry::initialize_statics();
}
auto proxy = ProxyFactory::create_proxy(cmd_args[Helper::SERVICE], props);
if (proxy == nullptr) {
Utils::error("Could not create proxy for service or client is inactive: " +
Expand Down
15 changes: 14 additions & 1 deletion src/main/helpers/Helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ string Helper::CORRELATION_QUERIES = "correlation-queries";
string Helper::CORRELATION_REPLACEMENTS = "correlation-replacements";
string Helper::CORRELATION_MAPPINGS = "correlation-mappings";
string Helper::FITNESS_FUNCTION_TAG = "fitness-function-tag";
string Helper::POPULATION_SIZE = "population-size";
string Helper::MAX_GENERATIONS = "max-generations";
string Helper::ELITISM_RATE = "elitism-rate";
string Helper::SELECTION_RATE = "selection-rate";
string Helper::TOTAL_ATTENTION_TOKENS = "total-attention-tokens";
string Helper::USE_CONTEXT_CACHE = "use-context-cache";
string Helper::ENFORCE_CACHE_RECREATION = "enforce-cache-recreation";
string Helper::INITIAL_RENT_RATE = "initial-rent-rate";
Expand Down Expand Up @@ -127,8 +132,11 @@ This client sends query evolution requests to the Evolution Agent via the servic
It requires the following arguments:
- query: The query to be processed.
- correlation-queries: The correlation queries associated with the evolution request.
Example format: "query1,query2,query3"
- correlation-replacements: The correlation replacements for the evolution request.
Example format: "C1:S1,C2:S2;C3:S3,C4:S4"
- correlation-mappings: The correlation mappings for the evolution request.
Example format: "C1:S1,C2:S2"
- context: The context in which the evolution should be evaluated.
- fitness-function-tag: The fitness function tag to be used.
)")},
Expand Down Expand Up @@ -247,7 +255,12 @@ vector<string> Helper::get_required_arguments(const string& processor_type,
}
case ProcessorType::EVOLUTION_AGENT:
if (caller_type == ServiceCallerType::CLIENT) {
return {REQUEST, MAX_ANSWERS, ATTENTION_UPDATE_FLAG, REPEAT_COUNT};
return {QUERY,
CORRELATION_QUERIES,
CORRELATION_REPLACEMENTS,
CORRELATION_MAPPINGS,
CONTEXT,
FITNESS_FUNCTION_TAG};
} else {
return {ATTENTION_BROKER_ENDPOINT};
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/helpers/Helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Helper {
static string CORRELATION_REPLACEMENTS;
static string CORRELATION_MAPPINGS;
static string FITNESS_FUNCTION_TAG;
static string POPULATION_SIZE;
static string MAX_GENERATIONS;
static string ELITISM_RATE;
static string SELECTION_RATE;
static string TOTAL_ATTENTION_TOKENS;
static string USE_CONTEXT_CACHE;
static string ENFORCE_CACHE_RECREATION;
static string INITIAL_RENT_RATE;
Expand Down
Loading