Fix for cogapp on Python 3.8, refs #82

This commit is contained in:
Simon Willison 2023-07-10 14:12:20 -07:00
parent 9f25cde60e
commit 898418a518
2 changed files with 6 additions and 4 deletions

View file

@ -120,7 +120,7 @@ OpenAI Chat: gpt-3.5-turbo (aliases: 3.5, chatgpt)
likelihood to talk about new topics.
stop: str
A string where the API will stop generating further tokens.
logit_bias: Union[dict, str, NoneType]
logit_bias: dict, str
Modify the likelihood of specified tokens appearing in the completion.
OpenAI Chat: gpt-3.5-turbo-16k (aliases: chatgpt-16k, 3.5-16k)
temperature: float
@ -129,7 +129,7 @@ OpenAI Chat: gpt-3.5-turbo-16k (aliases: chatgpt-16k, 3.5-16k)
frequency_penalty: float
presence_penalty: float
stop: str
logit_bias: Union[dict, str, NoneType]
logit_bias: dict, str
OpenAI Chat: gpt-4 (aliases: 4, gpt4)
temperature: float
max_tokens: int
@ -137,7 +137,7 @@ OpenAI Chat: gpt-4 (aliases: 4, gpt4)
frequency_penalty: float
presence_penalty: float
stop: str
logit_bias: Union[dict, str, NoneType]
logit_bias: dict, str
OpenAI Chat: gpt-4-32k (aliases: 4-32k)
temperature: float
max_tokens: int
@ -145,7 +145,7 @@ OpenAI Chat: gpt-4-32k (aliases: 4-32k)
frequency_penalty: float
presence_penalty: float
stop: str
logit_bias: Union[dict, str, NoneType]
logit_bias: dict, str
```
<!-- [[[end]]] -->

View file

@ -382,6 +382,8 @@ def models_list(options):
type_info = str(field.annotation).replace("typing.", "")
if type_info.startswith("Optional["):
type_info = type_info[9:-1]
if type_info.startswith("Union[") and type_info.endswith(", NoneType]"):
type_info = type_info[6:-11]
bits = ["\n ", name, ": ", type_info]
if field.description and (
model_with_aliases.model.__class__