mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 16:43:58 +01:00
Compare commits
2 commits
45613e0537
...
83df730edb
Author | SHA1 | Date | |
---|---|---|---|
83df730edb | |||
a6af7bd1a4 |
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -7,9 +7,9 @@
|
|||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"**/__pycache__": true,
|
||||
"**/*.css.map": true,
|
||||
"**/.vscode": true,
|
||||
"**/*.map": true,
|
||||
"**/*.css.map": true,
|
||||
"tests/__pycache__": true
|
||||
},
|
||||
"hide-files.files": [
|
||||
|
|
|
@ -6,10 +6,9 @@ costs:
|
|||
other: 5
|
||||
|
||||
chat-models:
|
||||
gpt-4-32k-azure: 100
|
||||
gpt-4-32k: 200
|
||||
gpt-4: 50
|
||||
gpt-4-azure: 10
|
||||
gpt-3: 5
|
||||
gpt-3: 10
|
||||
|
||||
## Roles Explanation
|
||||
|
||||
|
|
|
@ -147,13 +147,15 @@ async def respond(
|
|||
print('[!] too many requests')
|
||||
continue
|
||||
|
||||
chunk_no = 0
|
||||
async for chunk in response.content.iter_any():
|
||||
chunk_no += 1
|
||||
chunk = chunk.decode('utf8').strip()
|
||||
|
||||
if 'azure' in provider_name:
|
||||
chunk = chunk.strip().replace('data: ', '')
|
||||
chunk = chunk.strip().replace('data: ', '', 1)
|
||||
|
||||
if not chunk or 'prompt_filter_results' in chunk:
|
||||
if not chunk or chunk_no == 1:
|
||||
continue
|
||||
|
||||
yield chunk + '\n\n'
|
||||
|
|
|
@ -100,7 +100,7 @@ async def test_chat_stream_gpt3() -> float:
|
|||
|
||||
async for chunk in response.aiter_text():
|
||||
for subchunk in chunk.split('\n\n'):
|
||||
chunk = subchunk.replace('data: ', '').strip()
|
||||
chunk = subchunk.replace('data: ', '', 1).strip()
|
||||
|
||||
if chunk == '[DONE]':
|
||||
break
|
||||
|
@ -216,7 +216,7 @@ async def demo():
|
|||
raise ConnectionError('API Server is not running.')
|
||||
|
||||
for func in [
|
||||
# test_chat_non_stream_gpt4,
|
||||
test_chat_non_stream_gpt4,
|
||||
test_chat_stream_gpt3
|
||||
]:
|
||||
print(f'[*] {func.__name__}')
|
||||
|
|
Loading…
Reference in a new issue