OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / cf5a8a3

Update README with design notes
cf5a8a3ba819413df2c811668e86b5f7f2cd2c8c
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-02T18:02:01.000Z

Changed files (2) +58 -37

scm/pair-agent/README.md +55 -3
……@@ -1,6 +1,58 @@
1Text processing agent
2---------------------
3***Design goal***: Agent that reads text and responds, by generating text.
4
5***Prototype***: Read text files, count word pairs, and generate
6high-ranked word-pair streams. The pair-counting agent is in
7`pair-agent.scm` and the generator is in `generator.scm`.
8
9***Motivation***: Word-pairs stand in for generic complex networks of
10occurances in the sensory environment that correlate with agent internal
11state. The agent sees and responds to the environment. The generation
12stream is a stand-in for generic agent motor control: after seeing and
13"thinking", the agent "responds" with "actions" out into the external
14environment.
115
216## Pair counting agent
3Prototyping for a more agential approach.
17Prototype proof of concept. Implemented in `pair-agent.scm`.
18Counts word-pairs, observed by looking at a text file. The Sensory API
19(implemented in `(use-modules (opencog sensory))`) is general enough to
20allow arbitrary text sources, including chat.
21
22The dataflow pipeline is hand-crafted. The sensory API is supposed to
23eventually auto-build these pipelines, but that code is not working yet.
24
25### Design Notes
26Here's the design we want for the pair-counting agent:
27
281) Some source of text strings. This source blocks if there's
29 nothing to be read; else it returns the next string. The SRFI's
30 call this a generator. The `OpenLink` provided by `sensory.scm`
31 provides exactly this, so we're good.
322) (Optional) Some way to split one source into multiple sources.
33 Maybe this:
34 https://wiki.opencog.org/w/PromiseLink#Multiplex_Example
35 but what happens if the readers don't both read ???
363) A Filter that takes above and increments pair counts.
37 Done. Its non-atomic, but so what. Perhaps we can live with
38 that, given that sampling is statistical, anyway.
394) Execution control. There are two choices:
40
41 ***Pull***: infinite loop polls on promise. Source blocks if
42 no input.
43 ***Push***: Nothing happens until source triggers; then a cascade
44 of effects downstream.
45 - Right now, the general infrastructure supports Pull naturally.
46 - There aren't any push demos.
47 - Attention control is easier with Pull.
448
5Some prototype sketches and notes.
6Nothing works here yet.
49### TODO/Open issues
50Some unresolved issues.
51* Parser wants strings as `Node`s; it would be nice to be able to work
52 with `StringValue`.
53* Need to call `cog-execute!` in a loop, to loop over whole file. Would
54 be nicer to not have to do this. This is a bug; the `OutputStream`
55 class does run an inf loop on streams, but that loop fails on things
56 that have a `Filter` in the middle.
57* End-of-file results in a throw from parser. This is a side effect.
58 The throw should happen from the file-reader, directly.
scm/pair-agent/count-agent.scm +3 -34
……@@ -4,9 +4,9 @@
44; Prototype hand-built agent capable of counting things observed
55; in the external environment.
66;
7; Currently, this demos counting of word-pairs observed by looking at
8; a text file. (The Sensory API should allow easy generalization to
9; other text sources.)
7; Demos counting of word-pairs observed by looking at a text file.
8; The Sensory API allows easy generalization to other text sources,
9; so working with files is OK for now.
1010;
1111; The dataflow pipeline is hand-crafted. (The sensory API is supposed
1212; to eventually auto-build these pipelines, but that code is not working
……@@ -20,37 +20,6 @@
2020(use-modules (opencog sensory))
2121(use-modules (srfi srfi-1))
2222
23; Here's the design we want:
24; 1) Some source of text strings. This source blocks if there's
25; nothing to be read; else it returns the next string. The SRFI's
26; call this a generator. The `OpenLink` provided by `sensory.scm`
27; is a suitable source.
28; 1a) TODO... Parser wants strings as Nodes; it would be nice to
29; be able to work with StringValue.
30; 2) (Optional) Some way to split one source into multiple sources.
31; Maybe this:
32; https://wiki.opencog.org/w/PromiseLink#Multiplex_Example
33; but what happens if the readers don't both read ???
34; 3) A Filter that takes above and increments pair counts.
35; Done. Its non-atomic, but so what. Perhaps we can live with
36; that, given that sampliing is statistical, anyway.
37; 4) Execution control. There are two choices:
38; Pull: infinite loop polls on promise. Source blocks if
39; no input.
40; Push: Nothing happens until source triggers; then a cascade
41; of effects downstream.
42; Right now, the general infrastructure supports Pull naturally.
43; There aren't any push demos.
44; Attention control is easier with Pull.
45;
46; The below demos this design.
47;
48; Open issues:
49; *) Need to call cog-execute! in a loop, to loop over whole file.
50; Would be nicer to not have to do this.
51; *) End-of-file results in a throw from parser. This is a side
52; effect. We need some proper end-of-file handling.
53
5423; --------------------------------------------------------------
5524; Return a text parser that counts edges on a stream. The
5625; `txt-stream` must be an Atom that can serve as a source of text.