Liking cljdoc? Tell your friends :D

dobby.model.gpt


*default-credentialsclj

source

apply-deltacljmultimethod

Determines how to apply a delta to a message that will be sent to the model's output channel. Should handle content messages as well as function call messages

Determines how to apply a delta to a message that will be sent to the model's output
channel. Should handle content messages as well as function call messages
sourceraw docstring

create-modelclj

(create-model params)

Create a GPT backed model

Create a GPT backed model
sourceraw docstring

create-requestclj

(create-request credentials data)

Create a request object that can be used to stream responses from the OpenAI API

Create a request object that can be used to stream responses from the OpenAI API
sourceraw docstring

get-credentialsclj

(get-credentials params)

Supports getting credentials from the given params or from the environment.

If credentials are not found in the params, then the environment is checked for the values OPEN_AI_KEY and OPEN_AI_ORGANIZATION

Supports getting credentials from the given params or from the environment.

If credentials are not found in the params, then the environment is checked for the values
OPEN_AI_KEY and OPEN_AI_ORGANIZATION
sourceraw docstring

initialize*clj

(initialize* model agent)
source

parse-bodyclj

(parse-body bytes)

Parse the response body line by line, returning a lazy sequence of parsed lines as results containing a type and associated data (see parse-line)

Parse the response body line by line, returning a lazy sequence of parsed lines
as results containing a type and associated data (see parse-line)
sourceraw docstring

parse-errorclj

(parse-error error-string)

Parse an error into a Clojure map

Parse an error into a Clojure map
sourceraw docstring

parse-lineclj

(parse-line line)

Parse a line of the response body, returning a tuple containing a result type and the parsed data. The result type is one of :done, :data, or :error. The data value will either be nil for :done, a map for :data, or the raw line for :error

Parse a line of the response body, returning a tuple containing a result type
and the parsed data. The result type is one of :done, :data, or :error. The data
value will either be nil for :done, a map for :data, or the raw line for :error
sourceraw docstring

parse-messageclj

(parse-message message)

If a message has function call arguments, this will convert them into a Clojure map - otherwise the message is returned as is

If a message has function call arguments, this will convert them
into a Clojure map - otherwise the message is returned as is
sourceraw docstring

start*clj

(start* params channels get-context handler)

Start listening for messages on the model's input channel. When a message is received, it will be sent to the OpenAI API and the response will be streamed to the output channel. Any messages received on the close-ch will stop the model and close all channels. The get-context function is responsible for returning a vector of messages to append new messages to. This is what establishes the context of the conversation.

See the stream-response function for details on how the given handler will be called

Start listening for messages on the model's input channel. When a message is received,
it will be sent to the OpenAI API and the response will be streamed to the output channel. Any
messages received on the close-ch will stop the model and close all channels. The get-context
function is responsible for returning a vector of messages to append new messages to. This is
what establishes the context of the conversation.

See the stream-response function for details on how the given handler will be called
sourceraw docstring

stream-responseclj

(stream-response request output handler)

Stream a response from GPT. When a message or error is completed, it will be sent to the given output channel. The given handler function will be called with events 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
Stream a response from GPT. When a message or error is completed, it will
be sent to the given output channel. The given handler function will be called
with events 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
sourceraw docstring

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

× close