The storeResponse
function stores user interactions, analyzing the content, emotions, and context, and returns an object containing metadata about the interaction. It selects a model, checks for existing conversation files, and updates the conversation data in memory and the file system, generating a summary and keywords for the interaction.
This code is a Node.js module that imports necessary modules and variables, defines functions for retrieving recent messages from conversations, and implements file system operations for loading and storing conversation data. The module exports the messageRecents
function, along with other variables and constants, allowing it to be used in other applications.
The relevantHistory
function retrieves relevant conversation history files based on a given prompt, returning an array of file names. This function requires importer.import('general chit chat')
to be called prior to usage and uses synchronous file system operations, logging input and output to the console.
The relevantKeywords
function searches through a user's past conversations to find relevant keywords for a given prompt, using a specified model to retrieve and match keywords. It returns an array of keywords that match the prompt, eliminating duplicates and extraneous characters from extracted keywords.
The code imports constants and uses two functions, askLlamaMatchTimestamps
and matchingTimestamps
, to process timestamps and generate responses based on keywords and prompts. The matchingTimestamps
function iterates over conversations, generates messages, and calls the askLlamaMatchTimestamps
function to match timestamps with the generated responses, returning an array of matching timestamps.
This code defines a set of functions and constants to facilitate interacting with an API, including generating a description of the API functions and asking the user to match a prompt with an API function. The code exports four values, allowing other parts of the program to access and use the API functions and their corresponding exports and descriptions.
handle conversationThe handleConversation
function is an asynchronous function that handles a conversation by classifying the prompt, storing the response, generating a response from a language model, and storing the final response. It takes five parameters, including promptModel
, session
, prompt
, image
, and otr
, and returns the final response after processing the language model's output and storing relevant information.
The classifyPrompt
function takes a prompt and image as input, matches the prompt to a specific function, and executes that function with the provided arguments to generate a response. The function iterates over matching functions, imports and parameterizes each one, and returns the result with additional memories, except for the doStableRequest
function which returns a combined object.
This code consists of two functions, listMemories
and findMemories
, which are used to retrieve memories from a file system, with listMemories
transforming memory keys into dates and returning an array of strings. The findMemories
function searches for memories in a specific file or in a history of files, returning the memories object and caching the result for future reuse.
The code imports necessary modules and constants, then defines an asynchronous function manageMemories
that handles memory management, including loading and saving memories based on user input. The function uses regular expressions to match user responses to different memory functions, such as saving, removing, or listing memories, and performs the corresponding actions.