Skip to content

Commit

Permalink
Remove logging of sensitive chat history. [issue 1965] (#2008) (#2012)
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Lee <austin@aryn.ai>
(cherry picked from commit ddebae7)

Co-authored-by: Austin Lee <austin@aryn.ai>
  • Loading branch information
opensearch-trigger-bot[bot] and austintlee authored Feb 5, 2024
1 parent f5f1bce commit 90cb31a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public SearchResponse processResponse(SearchRequest request, SearchResponse resp
throw new IllegalArgumentException("llm_model cannot be null.");
}
String conversationId = params.getConversationId();
log.info("LLM question: {}, LLM model {}, conversation id: {}", llmQuestion, llmModel, conversationId);

log.info("LLM model {}, conversation id: {}", llmModel, conversationId);
Instant start = Instant.now();
Integer interactionSize = params.getInteractionSize();
if (interactionSize == null || interactionSize == GenerativeQAParameters.SIZE_NULL_VALUE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ChatCompletionOutput doChatCompletion(ChatCompletionInput chatCompletionI

// Response from a remote model
Map<String, ?> dataAsMap = modelOutput.getMlModelOutputs().get(0).getMlModelTensors().get(0).getDataAsMap();
log.info("dataAsMap: {}", dataAsMap.toString());
// log.info("dataAsMap: {}", dataAsMap.toString());

// TODO dataAsMap can be null or can contain information such as throttling. Handle non-happy cases.

Expand All @@ -104,7 +104,7 @@ protected Map<String, String> getInputParameters(ChatCompletionInput chatComplet
chatCompletionInput.getContexts()
);
inputParameters.put(CONNECTOR_INPUT_PARAMETER_MESSAGES, messages);
log.info("Messages to LLM: {}", messages);
// log.info("Messages to LLM: {}", messages);
} else if (chatCompletionInput.getModelProvider() == ModelProvider.BEDROCK) {
inputParameters
.put(
Expand All @@ -122,7 +122,7 @@ protected Map<String, String> getInputParameters(ChatCompletionInput chatComplet
throw new IllegalArgumentException("Unknown/unsupported model provider: " + chatCompletionInput.getModelProvider());
}

log.info("LLM input parameters: {}", inputParameters.toString());
// log.info("LLM input parameters: {}", inputParameters.toString());
return inputParameters;
}

Expand All @@ -138,14 +138,15 @@ protected ChatCompletionOutput buildChatCompletionOutput(ModelProvider provider,
errors = List.of((String) error.get(CONNECTOR_OUTPUT_MESSAGE));
} else {
Map firstChoiceMap = (Map) choices.get(0);
log.info("Choices: {}", firstChoiceMap.toString());
// log.info("Choices: {}", firstChoiceMap.toString());
Map message = (Map) firstChoiceMap.get(CONNECTOR_OUTPUT_MESSAGE);
/*
log
.info(
"role: {}, content: {}",
message.get(CONNECTOR_OUTPUT_MESSAGE_ROLE),
message.get(CONNECTOR_OUTPUT_MESSAGE_CONTENT)
);
);*/
answers = List.of(message.get(CONNECTOR_OUTPUT_MESSAGE_CONTENT));
}
} else if (provider == ModelProvider.BEDROCK) {
Expand Down

0 comments on commit 90cb31a

Please sign in to comment.