From aa37d3307fc8256689ddd674777a62f38500f51a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 10 Jul 2023 15:43:44 -0700 Subject: [PATCH] Example for logit_bias, closes #36 --- docs/usage.md | 1 + llm/default_plugins/openai_models.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/usage.md b/docs/usage.md index 827a544..9abc258 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -122,6 +122,7 @@ OpenAI Chat: gpt-3.5-turbo (aliases: 3.5, chatgpt) A string where the API will stop generating further tokens. logit_bias: dict, str Modify the likelihood of specified tokens appearing in the completion. + Pass a JSON string like '{"1712":-100, "892":-100, "1489":-100}' OpenAI Chat: gpt-3.5-turbo-16k (aliases: chatgpt-16k, 3.5-16k) temperature: float max_tokens: int diff --git a/llm/default_plugins/openai_models.py b/llm/default_plugins/openai_models.py index 38a7c54..72c62b0 100644 --- a/llm/default_plugins/openai_models.py +++ b/llm/default_plugins/openai_models.py @@ -110,7 +110,8 @@ class Chat(Model): ) logit_bias: Optional[Union[dict, str]] = Field( description=( - "Modify the likelihood of specified tokens appearing in the completion." + "Modify the likelihood of specified tokens appearing in the completion. " + 'Pass a JSON string like \'{"1712":-100, "892":-100, "1489":-100}\'' ), default=None, )