Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/bedrock issues #2718

Merged
merged 2 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def chat(self, system, history, gen_conf):
modelId=self.model_name,
messages=history,
inferenceConfig=gen_conf,
system=[{"text": system}] if system else None,
system=[{"text": (system if system else "Answer the user's message.")}] ,
)

# Extract and print the response text.
Expand Down Expand Up @@ -675,7 +675,8 @@ def chat_streamly(self, system, history, gen_conf):
streaming_response = self.client.converse_stream(
modelId=self.model_name,
messages=history,
inferenceConfig=gen_conf
inferenceConfig=gen_conf,
system=[{"text": system if system else ""}],
)

# Extract and print the streamed response text in real-time.
Expand Down
2 changes: 1 addition & 1 deletion rag/llm/embedding_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def encode_queries(self, text):

response = self.client.invoke_model(modelId=self.model_name, body=json.dumps(body))
model_response = json.loads(response["body"].read())
embeddings.extend([model_response["embedding"]])
embeddings.extend(model_response["embedding"])

return np.array(embeddings), token_count

Expand Down