(add-state-watch agent id fn-3)
Add a function that gets called whenever the agent's internal state changes. The given function will be called with the agent, old value and new value. Possible values are: :inert - The agent is not doing anything :waiting - The agent is waiting to respond :responding - The agent is currently responding to a message
Add a function that gets called whenever the agent's internal state changes. The given function will be called with the agent, old value and new value. Possible values are: :inert - The agent is not doing anything :waiting - The agent is waiting to respond :responding - The agent is currently responding to a message
(context agent)
Get the agent's current context. An agent's log can not be accessed until it is started
Get the agent's current context. An agent's log can not be accessed until it is started
(create-agent initial-prompt on-message)
(create-agent initial-prompt on-message dependencies)
Create a new agent. The on-message function is called with the agent and a complete message after a stream is fully consumed. An optional dependencies map can be provided so dependencies can be accessed when invoking functions
Create a new agent. The on-message function is called with the agent and a complete message after a stream is fully consumed. An optional dependencies map can be provided so dependencies can be accessed when invoking functions
(defagent & args)
Create an agent. This macro is structed just like clojure.core/defn. The differences are that the doc string will be used as the initial prompt and if an attrs-map is given, it will be used to provide additional parameters to GPT. Passing a function defined by defunction will ensure that the malli schema is used to generate the appropriate schema for GPT
Create an agent. This macro is structed just like clojure.core/defn. The differences are that the doc string will be used as the initial prompt and if an attrs-map is given, it will be used to provide additional parameters to GPT. Passing a function defined by defunction will ensure that the malli schema is used to generate the appropriate schema for GPT
(defunction & args)
Define a function that can be invoked by an agent. Any function with a json-schema structure defined as meta data can be used by an agent. These functions should have an argument signature of [agent args]
Define a function that can be invoked by an agent. Any function with a json-schema structure defined as meta data can be used by an agent. These functions should have an argument signature of [agent args]
(dispatch agent message)
Invoke a function if the message indicates one should be called. Only supports functions defined with defunction
Invoke a function if the message indicates one should be called. Only supports functions defined with defunction
(invoke agent args func)
(invoke agent args func name)
Invoke a function and send the result to the agent as a message. If not calling a function defined by defunction, you must provide a name. Functions are invoked with the agent and the arguments given
Invoke a function and send the result to the agent as a message. If not calling a function defined by defunction, you must provide a name. Functions are invoked with the agent and the arguments given
(remove-state-watch agent id)
Remove a state watch identified by the given id from an agent
Remove a state watch identified by the given id from an agent
(send-message agent message)
Send a message to an agent
Send a message to an agent
(send-text agent text)
Sent a text message to an agent. Will send it via the user role
Sent a text message to an agent. Will send it via the user role
(start-agent! agent)
(start-agent! agent log)
Start an agent. The given log will be used to store context. Give a log with pre-seeded data to start the agent with prior knowledge.
Start an agent. The given log will be used to store context. Give a log with pre-seeded data to start the agent with prior knowledge.
(state agent)
Get the current state of the agent
Get the current state of the agent
(stop-agent! agent)
Stop an agent. Closes input and output channels
Stop an agent. Closes input and output channels
(stream-chat agent fn-1)
Stream chat text from an agent. Calls the given function everytime a chunk of non function output is received. The function will be called with chunks of text as they become available. Useful for realtime responses
Stream chat text from an agent. Calls the given function everytime a chunk of non function output is received. The function will be called with chunks of text as they become available. Useful for realtime responses
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close