mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-30 01:35:14 +02:00
Bedrock LLM fix
This commit is contained in:
parent
f349c8a72e
commit
90fe017240
1 changed files with 48 additions and 7 deletions
|
|
@ -69,13 +69,54 @@ class Processor(ConsumerProducer):
|
||||||
|
|
||||||
prompt = v.prompt
|
prompt = v.prompt
|
||||||
|
|
||||||
promptbody = json.dumps({
|
# Mistral Input Format
|
||||||
"prompt": prompt,
|
if self.model.startswith("mistral"):
|
||||||
"max_tokens": 8192,
|
promptbody = json.dumps({
|
||||||
"temperature": 0.0,
|
"prompt": prompt,
|
||||||
"top_p": 0.99,
|
"max_tokens": 8192,
|
||||||
"top_k": 40
|
"temperature": 0.0,
|
||||||
})
|
"top_p": 0.99,
|
||||||
|
"top_k": 40
|
||||||
|
})
|
||||||
|
|
||||||
|
# Llama 3.1 Input Format
|
||||||
|
elif self.model.startswith("meta"):
|
||||||
|
promptbody = json.dumps({
|
||||||
|
"prompt": prompt,
|
||||||
|
"max_gen_len": 2048,
|
||||||
|
"temperature": 0.0,
|
||||||
|
"top_p": 0.95,
|
||||||
|
})
|
||||||
|
|
||||||
|
# Anthropic Input Format
|
||||||
|
elif self.model.startswith("anthropic"):
|
||||||
|
promptbody = json.dumps({
|
||||||
|
"anthropic_version": "bedrock-2023-05-31",
|
||||||
|
"max_tokens": 8192,
|
||||||
|
"temperature": 0,
|
||||||
|
"top_p": 0.999,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": prompt
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
# Use Mistral format as defualt
|
||||||
|
else:
|
||||||
|
promptbody = json.dumps({
|
||||||
|
"prompt": prompt,
|
||||||
|
"max_tokens": 8192,
|
||||||
|
"temperature": 0.0,
|
||||||
|
"top_p": 0.99,
|
||||||
|
"top_k": 40
|
||||||
|
})
|
||||||
|
|
||||||
accept = 'application/json'
|
accept = 'application/json'
|
||||||
contentType = 'application/json'
|
contentType = 'application/json'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue