Created
July 31, 2023 19:11
-
-
Save greenido/0f072b3189f4b3b0a37863d1745ad1fb to your computer and use it in GitHub Desktop.
Push you LLM to JFrog Artifactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import fs from 'fs'; | |
// Artifactory configuration | |
const ARTIFACTORY_URL = 'https://your-artifactory-url.com'; | |
const ARTIFACTORY_REPO = 'your-repo-name'; | |
const ARTIFACTORY_USERNAME = 'your-username'; | |
const ARTIFACTORY_API_KEY = 'your-api-key'; | |
// LLM model file path | |
const LLM_MODEL_FILE = 'path/to/your/llm_model.tar.gz'; | |
async function pushToArtifactory() { | |
const url = `${ARTIFACTORY_URL}/${ARTIFACTORY_REPO}/llm_model.tar.gz`; | |
const headers = { | |
Authorization: `Bearer ${ARTIFACTORY_API_KEY}`, | |
'X-JFrog-Art-Api': ARTIFACTORY_API_KEY, | |
}; | |
try { | |
const data = fs.readFileSync(LLM_MODEL_FILE); | |
const response = await axios.put(url, data, { headers }); | |
if (response.status === 201) { | |
console.log('LLM model pushed to Artifactory successfully!'); | |
} else { | |
console.error(`Failed to push LLM model. Status Code: ${response.status}, Message: ${response.statusText}`); | |
} | |
} catch (error) { | |
console.error(`Error while pushing the LLM model to Artifactory: ${error.message}`); | |
} | |
} | |
pushToArtifactory(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment