Liking cljdoc? Tell your friends :D

cog.town

Build agentic workflows with core.async channels. A cog is just a channel with context. That context is updated via a transition function that is invoked on a separate thread

Build agentic workflows with core.async channels. A cog is just a channel
with context. That context is updated via a transition function that is invoked
on a separate thread
raw docstring

cogclj

(cog context transition & [buf-or-n xf ex-handler])

A cog is a channel that encapsulates context and the transition function that updates it. The transition function is an arity 2 function that is called with the context and the input message that triggers an update to the context. transition will be called in a separate thread. transition should return the message that will be sent to the output channel. Additional arguments follow the same semantics as a core.async channel. xf is an output channel only transducer. context can be any type as long as transition can make use of it.

A Cog is also a mult, so feel free to tap it if you want to send outputs to other channels.

A cog is a channel that encapsulates context and the transition function
that updates it. The transition function is an arity 2 function that is called
with the context and the input message that triggers an update to the context. transition
will be called in a separate thread. transition should return the message that will be sent to the output channel.
Additional arguments follow the same semantics as a core.async channel. xf is an output channel only transducer.
context can be any type as long as transition can make use of it.

A Cog is also a mult, so feel free to tap it if you want to send outputs to other channels.
sourceraw docstring

cog?clj

(cog? x)
source

contextclj

(context cog)
source

dialogueclj

(dialogue c1 c2 & [buf-or-n xf ex-handler])

A channel where composed channels send their output as input to the next channel. This happens until the sun burns out or the dialogue is closed. Requires seed input to message first agent in the dialogue. (Then you should really just stay out of it)

A channel where composed channels send their output as input
to the next channel. This happens until the sun burns out or the dialogue
is closed. Requires seed input to message first agent in the dialogue. (Then you should really
just stay out of it)
sourceraw docstring

extendclj

(extend cog io)
(extend cog io transition)

A special case of forking useful for extending the semantics of input and ouput for a cog.

A special case of forking useful for extending the semantics of input and
ouput for a cog.
sourceraw docstring

fanoutclj

(fanout chs & [xf ex-handler])

A channel that takes a value and puts it on all channels in the sequence. The optional transducer will be applied to EACH output value in the sequence. The transducer will be applied via a pipeline-blocking operation. output will be sent as an ordered vector of each channel's output. A scatter-gather pattern.

A channel that takes a value and puts it on all channels in the sequence. The optional transducer will be
applied to EACH output value in the sequence. The transducer will be applied via a pipeline-blocking operation.
output will be sent as an ordered vector of each channel's output. A scatter-gather pattern.
sourceraw docstring

flowclj

(flow chs & [buf-or-n xf ex-handler])

A channel that passes previous output as input to the next channel in sequence. The optional transducer will be applied to EACH output value in the sequence.

A channel that passes previous output as input to the next channel in sequence. The optional transducer will be
applied to EACH output value in the sequence.
sourceraw docstring

forkclj

(fork cog)
(fork cog context-fn)
(fork cog context-fn io)
(fork cog context-fn io transition)

returns a new cog derived from the given cog. The new cog is created with a separate io channel and mult. context-fn is called with cog's context and should return a new context (or the same one). A new transition function can be given, or can be explicitly set to nil to prevent transitions. A typical use case for disabling transitions is when forking purely for the purpose of transforming output modality. All map fields from cog will be merged into the new cog

returns a new cog derived from the given cog. The new cog is created
with a separate io channel and mult. context-fn is called with cog's context
and should return a new context (or the same one). A new transition function
can be given, or can be explicitly set to nil to prevent transitions. A typical
use case for disabling transitions is when forking purely for the purpose
of transforming output modality. All map fields from cog will be merged into the new cog
sourceraw docstring

gateclj

(gate ch & [buf-or-n xf ex-handler])

Returns a channel that will release the value of ch when the gate receives any input. The output produced by a gate is a tuple containing the original input and the value of ch. buf-or-n, xf, and ex-handler are optional and follow normal chan semantics. A gate is useful for plugging a channel into a flow (potentially with some transformation). Also useful for forwarding messages through a sequence of channels.

Returns a channel that will release the value of ch when the gate receives any input. The output produced
by a gate is a tuple containing the original input and the value of ch. buf-or-n, xf, and ex-handler are optional
and follow normal chan semantics. A gate is useful for plugging a channel into a flow (potentially with some transformation). Also
useful for forwarding messages through a sequence of channels.
sourceraw docstring

io-chanclj

(io-chan in-ch out-ch)

Create a channel that separates input and output such that takes are from out-ch and puts are to in-ch.

Create a channel that separates input and output
such that takes are from out-ch and puts are to
in-ch.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close