Module: lib/db/writes

Members

(inner, constant) systemInstruction

Some prompt instructions for the AI to generate completions.

Some prompt instructions for the AI to generate completions.

Source:

Methods

(static) createAIComment(comment, postId)

Generates a comment from a completion, created by an AI.

Generates a comment from a completion, created by an AI. It uses the createComment method to create the comment.

Parameters:
Name Type Description
comment string
postId string
Source:
To Do:
  • move AI logic from createComment to this method

(static) generateCompletion(postId, text, session, userId)

Starts the completion generation process, which is followed by a human-in-the-loop review process until it gets back to this service

session and userId params are optional because this method has two possible workflows, one using the session and the other using the userIds.

Starts the completion generation process, which is followed by a human-in-the-loop review process until it gets back to this service

session and userId params are optional because this method has two possible workflows, one using the session and the other using the userIds. The session workflow starts on the frontend, while the userId workflow starts on the backend.

This is this way because saveCompletions method is, and this method calls it.

Parameters:
Name Type Description
postId string

The dream id

text string

The dream data text

session object

(Optional) The session object. If not provided, the userId must be provided.

userId string

(Optional) The user id. If not provided, the session must be provided.

Source:

(static) saveCompletion(completion, postId, userEmail, userId)

Saves a completion to the database

.

Saves a completion to the database

Parameters:
Name Type Description
completion *
postId *
userEmail *
userId *
Source:

(static) saveCosineSimilarityScore()

Saves the cosine similarity score between two texts.

Saves the cosine similarity score between two texts.

Source: