Abhaykoul commited on
Commit
3fc5c4e
1 Parent(s): a9962f2

Update webscout.py

Browse files
Files changed (1) hide show
  1. webscout.py +0 -17
webscout.py CHANGED
@@ -1728,20 +1728,3 @@ def fastai(user, model="llama3-70b", system="Answer as concisely as possible."):
1728
  return output
1729
 
1730
 
1731
- async def fastai_stream(user, model="llama3-8b", system="Answer as concisely as possible."):
1732
- env_type = "tp16405b" if "405b" in model else "tp16"
1733
- data = {'body': {'messages': [{'role': 'system', 'content': system}, {'role': 'user', 'content': user}], 'stream': True, 'model': model}, 'env_type': env_type}
1734
-
1735
- async with aiohttp.ClientSession() as session:
1736
- async with session.post('https://fast.snova.ai/api/completion', headers={'content-type': 'application/json'}, json=data) as response:
1737
- async for line in response.content:
1738
- line = line.decode('utf-8').strip()
1739
- if line.startswith('data:'):
1740
- try:
1741
- data = json.loads(line[len('data: '):])
1742
- content = data.get("choices", [{}])[0].get("delta", {}).get("content", '')
1743
- if content:
1744
- yield f"data: {json.dumps({'response': content})}\n\n"
1745
- except json.JSONDecodeError:
1746
- if line[len('data: '):] == '[DONE]':
1747
- break
 
1728
  return output
1729
 
1730