(close! agent)
Shut the agent down completely. Cannot be restarted. Closes the log according to dobby.impl.log/close!
Shut the agent down completely. Cannot be restarted. Closes the log according to dobby.impl.log/close!
(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 a new agent. The on-message function is called with the agent and a complete message after a stream is fully consumed.
Create a new agent. The on-message function is called with the agent and a complete message after a stream is fully consumed.
(create-log)
A default log implementation backed by an atom. Custom logs can be created by implementing the dobby.impl.log/Log protocol.
See dobby.impl.log/create-atom-log for implentation details
A default log implementation backed by an atom. Custom logs can be created by implementing the dobby.impl.log/Log protocol. See dobby.impl.log/create-atom-log for implentation details
(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
(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 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.
(stop-agent! agent)
Stop an agent. Messages will no longer be handled, but the agent can be restarted
Stop an agent. Messages will no longer be handled, but the agent can be restarted
(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 events as they become available.
Events are maps of the form {:type <type> :content <content>}
Types are as follows:
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 events as they become available. Events are maps of the form {:type <type> :content <content>} Types are as follows: - :begin - Represents that a response has started. :content will be nil - :text - Represents that text is available, :content will be a string containing the portion of the response - :end - Represnts that the response has ended. :content will be nil Useful for realtime responses
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close