toggleEmbedding

fun toggleEmbedding(prompt: String, embedding: String): String(source)

Toggles the presence of a specific embedding in the given prompt string.

If the embedding is not present in the prompt, it adds it. If the embedding is already present, it removes it from the prompt.

Return

A new string with the embedding either added or removed, depending on its initial presence.

Parameters

prompt

The input prompt string to modify. It's expected to be a comma or space-separated list of keywords.

embedding

The specific embedding to toggle in the prompt.