SillyTavern / SillyTavern

LLM Frontend for Power Users.

Home Page:https://sillytavern.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE_REQUEST] New macros

coomdev opened this issue · comments

Have you searched for similar requests?

Yes

Is your feature request related to a problem? If so, please describe.

A "problem" I'm often facing is that people sometimes write cards using "gender neutral" terms which completely breaks my immersion, as it's mostly narrated in third person. There are also cases where even jailbreaks and system prompts may need to refer to the character or the user, which "forces" the use of gender-neutral terms which in turn causes incoherence with the generated text.

This stems from the fact that when writing definitions, you don't know the gender of the persona being used (at writing time) when you're using a card, and when you're writing a jailbreak, you don't know the gender of either the persona, or the card, so authors sometimes end up using singular they, but from the perspective of the LLM, the gender IS (or could be) defined (at eval time). This makes the LLM perceive the de-facto gender as singular they, when it's really just being used as a kind of placeholder.

Describe the solution you'd like

No matter the solution, it would require inserting data in the extension field of the V2 spec, and providing UI to set these up, both in character and persona cards.

Possible solutions depend on the scope of use cases you'd want covered.
If you want to only cover what I believe is the most common case: third-person in normal English, then having 3 macros for nominative, accusative and genitive forms would be enough to cover the usual he/she/it/they (reflexive and dependent are derived from these shapes) but if you want to support languages other than English, these would become quite arbitrary and the only reasonable solution would be to have macros that can be substituted with data from the card spec extension field (that personas lack), but without some degree of standardization, it'd make the reuse between character cards and jailbreak definitions impossible.

As to how it'd be setup, I think a dropdown of a preset selection would make more sense, because some cards do not represent characters, but entire Scenarios, however jailbreak definitions have no way to determine which is which, assume it's a character, which can trip the model into hallucinating a character named after the scenario. I suppose the preset could be (Female/Male/Scenario/Other), that way, combined with #2052 and a dedicated macro, it'd allow jailbreaks to adapt for this edge-case.

Describe alternatives you've considered

Could be made into an extension? May rely on #1660

Additional context

No response

Priority

Low (Nice-to-have)

Are you willing to test this on staging/unstable branch if this is implemented?

Yes

commented

What you can do right now is use variables.
Character description:

{{setvar::they::he}}
{{setvar::them::him}}
{{setvar::their::his}}

{{char}} is a character. {{getvar::they}} like cats. {{char}} hates dogs ever since one bit {{getvar::them}} as a child at {{getvar::their}} friend's house.

You can do the same for the persona (maybe name the vars userThey and charThey).

The variables are set and accessible for the whole chat, so you can also use them in your jailbreak, world info, other prompt parts, ...

You'll notice from the example that there's more to switching from "they" to "he" than just replacing those words, or you'll end up with broken grammar, which the LLM will pick up on and negatively influence the generated text.
Special macros for gendering will not help with that either, since you'd need an entire grammar checker and fixer to deal with that. At which point, it might be easier to just ask the LLM to rewrite your prompts with a different gender...

Fair point, I forgot gendered languages were just that irregular.
Though I suppose having a distinction between scenarios and character cards could still be useful for global definitions to consider.