prasadnu commited on
Commit
0fcedcf
·
1 Parent(s): a4d2378

model changed to Haiku 3.5 for query re=write

Browse files
Files changed (1) hide show
  1. utilities/invoke_models.py +4 -6
utilities/invoke_models.py CHANGED
@@ -11,8 +11,6 @@ import streamlit as st
11
  #from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
12
  #import torch
13
 
14
- region = 'us-east-1'
15
-
16
  def get_bedrock_client():
17
  return boto3.client(
18
  'bedrock-runtime',
@@ -32,8 +30,8 @@ def invoke_model(input):
32
  }),
33
  modelId="amazon.titan-embed-text-v1",
34
  accept="application/json",
35
- contentType="application/json",
36
- performanceConfigLatency='optimized'
37
  )
38
 
39
  response_body = json.loads(response.get("body").read())
@@ -54,7 +52,7 @@ def invoke_model_mm(text,img):
54
  contentType = "application/json"
55
 
56
  response = bedrock_runtime_client.invoke_model(
57
- body=body, modelId=modelId, accept=accept, contentType=contentType,performanceConfigLatency='optimized'
58
  )
59
  response_body = json.loads(response.get("body").read())
60
  #print(response_body)
@@ -63,7 +61,7 @@ def invoke_model_mm(text,img):
63
  def invoke_llm_model(input,is_stream):
64
  if(is_stream == False):
65
  response = bedrock_runtime_client.invoke_model(
66
- modelId= "anthropic.claude-3-5-haiku-20241022-v1:0",#"anthropic.claude-3-5-sonnet-20240620-v1:0",,
67
  contentType = "application/json",
68
  accept = "application/json",
69
  performanceConfigLatency='optimized',
 
11
  #from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
12
  #import torch
13
 
 
 
14
  def get_bedrock_client():
15
  return boto3.client(
16
  'bedrock-runtime',
 
30
  }),
31
  modelId="amazon.titan-embed-text-v1",
32
  accept="application/json",
33
+ contentType="application/json"
34
+ #,performanceConfigLatency='optimized'
35
  )
36
 
37
  response_body = json.loads(response.get("body").read())
 
52
  contentType = "application/json"
53
 
54
  response = bedrock_runtime_client.invoke_model(
55
+ body=body, modelId=modelId, accept=accept, contentType=contentType#,performanceConfigLatency='optimized'
56
  )
57
  response_body = json.loads(response.get("body").read())
58
  #print(response_body)
 
61
  def invoke_llm_model(input,is_stream):
62
  if(is_stream == False):
63
  response = bedrock_runtime_client.invoke_model(
64
+ modelId= "us.anthropic.claude-3-5-haiku-20241022-v1:0"#"anthropic.claude-3-5-haiku-20241022-v1:0",#"anthropic.claude-3-5-sonnet-20240620-v1:0",,
65
  contentType = "application/json",
66
  accept = "application/json",
67
  performanceConfigLatency='optimized',