Template
26 lines
759 B
Python
26 lines
759 B
Python
import json, uuid, sys, os
|
|
|
|
content = open('/tmp/content.txt').read()
|
|
embed_resp = json.load(open('/tmp/embed_response.json'))
|
|
vector = embed_resp['embeddings'][0]
|
|
point_id = str(uuid.uuid4())
|
|
|
|
payload = {
|
|
"points": [{
|
|
"id": point_id,
|
|
"vector": vector,
|
|
"payload": {
|
|
"run_id": os.environ.get('RUN_ID', ''),
|
|
"event": os.environ.get('EVENT', ''),
|
|
"repository": os.environ.get('REPO', ''),
|
|
"branch": os.environ.get('BRANCH', ''),
|
|
"actor": os.environ.get('ACTOR', ''),
|
|
"timestamp": os.environ.get('TIMESTAMP', ''),
|
|
"content": content
|
|
}
|
|
}]
|
|
}
|
|
with open('/tmp/payload.json', 'w') as f:
|
|
json.dump(payload, f)
|
|
print(f"Point ID: {point_id}")
|