mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2024-10-06 15:48:26 +03:00
Added missing notes; Minor formatting fixes
This commit is contained in:
parent
815bd7430e
commit
9889080f32
@ -69,6 +69,7 @@ class OpenAIModel(ModelBackend):
|
||||
num_prompt_tokens = len(encoding.encode(string))
|
||||
gap_between_send_receive = 15 * len(kwargs["messages"])
|
||||
num_prompt_tokens += gap_between_send_receive
|
||||
|
||||
if openai_new_api:
|
||||
# Experimental, add base_url
|
||||
if BASE_URL:
|
||||
|
@ -92,8 +92,11 @@ def escape_string(value):
|
||||
return value
|
||||
|
||||
def is_url(url):
|
||||
try:
|
||||
result = urlparse(url)
|
||||
return all([result.scheme, result.netloc])
|
||||
except ValueError:
|
||||
return False
|
||||
"""
|
||||
Adapted from https://stackoverflow.com/questions/7160737/how-to-validate-a-url-in-python-malformed-or-not
|
||||
"""
|
||||
try:
|
||||
result = urlparse(url)
|
||||
return all([result.scheme, result.netloc])
|
||||
except ValueError:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user