Skip to content

Commit 90cb31a

Browse files
Remove logging of sensitive chat history. [issue 1965] (opensearch-project#2008) (opensearch-project#2012)
Signed-off-by: Austin Lee <austin@aryn.ai> (cherry picked from commit ddebae7) Co-authored-by: Austin Lee <austin@aryn.ai>
1 parent f5f1bce commit 90cb31a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

search-processors/src/main/java/org/opensearch/searchpipelines/questionanswering/generative/GenerativeQAResponseProcessor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ public SearchResponse processResponse(SearchRequest request, SearchResponse resp
126126
throw new IllegalArgumentException("llm_model cannot be null.");
127127
}
128128
String conversationId = params.getConversationId();
129-
log.info("LLM question: {}, LLM model {}, conversation id: {}", llmQuestion, llmModel, conversationId);
129+
130+
log.info("LLM model {}, conversation id: {}", llmModel, conversationId);
130131
Instant start = Instant.now();
131132
Integer interactionSize = params.getInteractionSize();
132133
if (interactionSize == null || interactionSize == GenerativeQAParameters.SIZE_NULL_VALUE) {

search-processors/src/main/java/org/opensearch/searchpipelines/questionanswering/generative/llm/DefaultLlmImpl.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ChatCompletionOutput doChatCompletion(ChatCompletionInput chatCompletionI
8383

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

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

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

125-
log.info("LLM input parameters: {}", inputParameters.toString());
125+
// log.info("LLM input parameters: {}", inputParameters.toString());
126126
return inputParameters;
127127
}
128128

@@ -138,14 +138,15 @@ protected ChatCompletionOutput buildChatCompletionOutput(ModelProvider provider,
138138
errors = List.of((String) error.get(CONNECTOR_OUTPUT_MESSAGE));
139139
} else {
140140
Map firstChoiceMap = (Map) choices.get(0);
141-
log.info("Choices: {}", firstChoiceMap.toString());
141+
// log.info("Choices: {}", firstChoiceMap.toString());
142142
Map message = (Map) firstChoiceMap.get(CONNECTOR_OUTPUT_MESSAGE);
143+
/*
143144
log
144145
.info(
145146
"role: {}, content: {}",
146147
message.get(CONNECTOR_OUTPUT_MESSAGE_ROLE),
147148
message.get(CONNECTOR_OUTPUT_MESSAGE_CONTENT)
148-
);
149+
);*/
149150
answers = List.of(message.get(CONNECTOR_OUTPUT_MESSAGE_CONTENT));
150151
}
151152
} else if (provider == ModelProvider.BEDROCK) {

0 commit comments

Comments
 (0)