diff --git a/community templates/Model_CosmosToCosmos/Model_CosmosToCosmos.json b/community templates/Model_CosmosToCosmos/Model_CosmosToCosmos.json new file mode 100644 index 00000000..5045a95e --- /dev/null +++ b/community templates/Model_CosmosToCosmos/Model_CosmosToCosmos.json @@ -0,0 +1 @@ +{"$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{"factoryName":{"type":"string","metadata":"Data Factory name"},"CosmosDbNoSql1":{"type":"string"},"RestService1":{"type":"string"}},"variables":{"factoryId":"[concat('Microsoft.DataFactory/factories/', parameters('factoryName'))]"},"resources":[{"name":"[concat(parameters('factoryName'), '/Model_CosmosToCosmos')]","type":"Microsoft.DataFactory/factories/pipelines","apiVersion":"2018-06-01","properties":{"activities":[{"name":"Lookup1","type":"Lookup","dependsOn":[],"policy":{"timeout":"0.12:00:00","retry":0,"retryIntervalInSeconds":30,"secureOutput":false,"secureInput":false},"userProperties":[],"typeProperties":{"source":{"type":"CosmosDbSqlApiSource","query":"select c.question, c.id from c where c.type= 2","preferredRegions":[],"detectDatetime":false},"dataset":{"referenceName":"CosmosDbNoSqlsource","type":"DatasetReference","parameters":{}},"firstRowOnly":false}},{"name":"ForEach1","type":"ForEach","dependsOn":[{"activity":"Lookup1","dependencyConditions":["Succeeded"]}],"userProperties":[],"typeProperties":{"items":{"value":"@activity('Lookup1').output.value\n","type":"Expression"},"isSequential":false,"activities":[{"name":"CopyData","type":"Copy","dependsOn":[],"policy":{"timeout":"7.00:00:00","retry":0,"retryIntervalInSeconds":30,"secureOutput":false,"secureInput":false},"userProperties":[],"typeProperties":{"source":{"type":"RestSource","additionalColumns":[{"name":"question","value":{"value":"@item().question","type":"Expression"}},{"name":"idquestion","value":{"value":"@item().id","type":"Expression"}}],"httpRequestTimeout":"00:01:40","requestInterval":"00.00:00:00.010","requestMethod":"POST","requestBody":{"value":"{\n \"model\": \"@{pipeline().parameters.model}\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"@{item().question}\"\n \n }\n ]\n }","type":"Expression"},"additionalHeaders":{"Authorization":{"value":"@concat('Bearer ',pipeline().parameters.token)","type":"Expression"},"Content-Type":"application/json"}},"sink":{"type":"CosmosDbSqlApiSink","writeBehavior":"insert"},"enableStaging":false},"inputs":[{"referenceName":"RestResource","type":"DatasetReference","parameters":{}}],"outputs":[{"referenceName":"CosmosDbNoSqlsink","type":"DatasetReference","parameters":{}}]}]}}],"policy":{"elapsedTimeMetric":{}},"parameters":{"model":{"type":"string","defaultValue":"gpt-3.5-turbo"},"token":{"type":"string","defaultValue":"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"}},"variables":{"varquestion":{"type":"String"}},"annotations":[],"lastPublishTime":"2024-02-17T19:25:14Z"},"dependsOn":["[concat(variables('factoryId'), '/datasets/CosmosDbNoSqlsource')]","[concat(variables('factoryId'), '/datasets/RestResource')]","[concat(variables('factoryId'), '/datasets/CosmosDbNoSqlsink')]"]},{"name":"[concat(parameters('factoryName'), '/CosmosDbNoSqlsource')]","type":"Microsoft.DataFactory/factories/datasets","apiVersion":"2018-06-01","properties":{"linkedServiceName":{"referenceName":"[parameters('CosmosDbNoSql1')]","type":"LinkedServiceReference"},"annotations":[],"type":"CosmosDbSqlApiCollection","schema":{"type":"object","properties":{"pergunta":{"type":"string"},"tipo":{"type":"integer"}}},"typeProperties":{"collectionName":"Items"}},"dependsOn":[]},{"name":"[concat(parameters('factoryName'), '/RestResource')]","type":"Microsoft.DataFactory/factories/datasets","apiVersion":"2018-06-01","properties":{"description":"Connection to your REST/HTTP","linkedServiceName":{"referenceName":"[parameters('RestService1')]","type":"LinkedServiceReference"},"annotations":[],"type":"RestResource","typeProperties":{},"schema":[]},"dependsOn":[]},{"name":"[concat(parameters('factoryName'), '/CosmosDbNoSqlsink')]","type":"Microsoft.DataFactory/factories/datasets","apiVersion":"2018-06-01","properties":{"linkedServiceName":{"referenceName":"[parameters('CosmosDbNoSql1')]","type":"LinkedServiceReference"},"annotations":[],"type":"CosmosDbSqlApiCollection","schema":{},"typeProperties":{"collectionName":"answers"}},"dependsOn":[]}]} \ No newline at end of file diff --git a/community templates/Model_CosmosToCosmos/manifest.json b/community templates/Model_CosmosToCosmos/manifest.json new file mode 100644 index 00000000..40a3ad40 --- /dev/null +++ b/community templates/Model_CosmosToCosmos/manifest.json @@ -0,0 +1,36 @@ +{ + "name":"Incremental copy from Cosmos DB using OpenAI API to Cosmos DB", + "image":"LookupLookup1ForEachForEach1ActivitiesCopyData+", + "icons":[ + "Lookup", + "ForEach" + ], + "requires":{ + "linkedservices":{ + "CosmosDbNoSql1":{ + "supportTypes":[ + "CosmosDb" + ] + }, + "RestService1":{ + "supportTypes":[ + "RestService" + ] + } + } + }, + "documentation": "https://github.com/WiliamRosa/azuredatafactory/blob/main/documentation/Copy%20from%20CosmosDB%20use%20OpenAI%20API%20to%20CosmosDB.md", + "contributorType": "Community", + "author":"WiliamRosa", + "annotations":[ + "Copy", + "Cosmos DB", + "REST API" + ], + "services":[ + + ], + "categories":[ + + ] +} \ No newline at end of file