Skip to content

Commit

Permalink
return json format of docs in result so that client can parse it easily.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxiaojiawow committed Jul 20, 2023
1 parent 1766b71 commit e022b0b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.collect.Maps;
import com.hw.langchain.chains.base.Chain;
import com.hw.langchain.chains.combine.documents.base.BaseCombineDocumentsChain;
import com.hw.langchain.chains.query.constructor.JsonUtils;
import com.hw.langchain.schema.Document;

import java.util.List;
Expand Down Expand Up @@ -82,7 +83,7 @@ public Map<String, String> innerCall(Map<String, Object> inputs) {
Map<String, String> result = Maps.newHashMap();
result.put(outputKey, answer);
if (this.returnSourceDocuments) {
result.put("source_documents", docs.toString());
result.put("source_documents", JsonUtils.toJsonStringWithIndent(docs, 4));
}
return result;
}
Expand Down

0 comments on commit e022b0b

Please sign in to comment.