1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
Cohere models support streaming, but you need to pass the "stream" : true
parameter in the JSON body to enable streaming, in addition to using the invoke_model_with_response_stream
API.
You can try the following code:
body = json.dumps({
"prompt": prompt,
"max_tokens": max_token_count,
"temperature": temperature,
"p": top_p,
"stop_sequences": stop_sequences,
"stream": True,
})
response = brt.invoke_model_with_response_stream(
modelId='cohere.command-text-v14',
body=body,
accept=accept,
contentType=contentType
)
stream = response.get('body')
if stream:
for event in stream:
chunk = event.get('chunk')
if chunk:
print(json.loads(chunk.get('bytes').decode()))
Contenus pertinents
- demandé il y a un an
- demandé il y a 7 mois
- demandé il y a 7 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 8 mois