Spaces:
Sleeping
Sleeping
File size: 1,455 Bytes
ae2a953 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
import os
import json
from openai import OpenAI
def generate_helm_chart():
client = OpenAI(
base_url="https://api.studio.nebius.ai/v1/",
api_key="N_KEY"
)
prompt = """
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
sh './gradlew build'
}
}
stage('Test') {
steps {
echo 'Testing...'
sh './gradlew test'
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
sh './deploy.sh'
}
}
}
}
"""
response = client.chat.completions.create(
model="Qwen/Qwen2-VL-72B-Instruct",
messages=[
{
"role": "user",
"content": [
{"type": "text",
"text": f"Convert this Jenkinsfile into a GitHub Actions workflow:\n\n{prompt}"}
],
}
],
max_tokens=300,
)
# Extracting and prettifying the content
if response.choices:
helm_chart_raw = response.choices[0].message.content
# Prettifying the output
print("\n--- Helm Chart Output (Prettified) ---\n")
print(helm_chart_raw.strip())
else:
print("No response received from the API.")
if __name__ == "__main__":
generate_helm_chart()
|