how to append multiple tags using JavaScript #682
-
The example code: async function run() { const formData = new FormData(); axios run();` What's the format for multiple tags(type:notes, type:test, user:username, etc) using formData.append() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
this should work: const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");
async function run() {
const fileBuffer = await fs.promises.readFile("README.md");
const formData = new FormData();
formData.append("file1", fileBuffer, { filename: "README.md" });
// setting the document ID, e.g. for updating an existing one
formData.append("documentId", "doc01");
// setting the index name
formData.append("index", "default");
// setting multiple tags
formData.append("tags", "type:news");
formData.append("tags", "year:2024");
// overriding the list of steps to execute
formData.append("steps", "extract,partition,gen_embeddings,save_records");
// overriding internal settings and/or using context arguments
formData.append("args", "{'custom_rag_temperature_float':0.5}");
axios
.post("http://127.0.0.1:9001/upload", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
}
run(); |
Beta Was this translation helpful? Give feedback.
this should work: