-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepCohereOnClient.sh
More file actions
executable file
·39 lines (35 loc) · 1.23 KB
/
Copy pathprepCohereOnClient.sh
File metadata and controls
executable file
·39 lines (35 loc) · 1.23 KB
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
#!/bin/bash
# Clear previous embedded_output.json
: > embedded_output.json
# Run testLibrList.sh to get libraries
LIBRARIES=$(./testLibrList.sh)
if [ $? -ne 0 ]; then
echo "Error: testLibrList.sh failed to execute" >&2
exit 1
fi
echo "testLibrList.sh output: $LIBRARIES"
# Check if libraries exist
if [ -z "$LIBRARIES" ] || [ "$LIBRARIES" = "[]" ]; then
echo "Error: No libraries found in testLibrList.sh output" >&2
exit 1
fi
# Process each library
for LIBRARY_ID in $(echo "$LIBRARIES" | jq -r '.[].id'); do
echo "Processing library $LIBRARY_ID"
RESPONSE=$(LIBRARY_ID=$LIBRARY_ID ./embed.py 2>&1)
if [ $? -eq 0 ]; then
# Read the entire embedded_output.json
if [ -s embedded_output.json ]; then
JSON_OUTPUT=$(cat embedded_output.json)
echo "JSON Response:"
echo "$JSON_OUTPUT" | jq . 2>/dev/null || echo "$JSON_OUTPUT"
else
echo "Warning: embedded_output.json is empty" >&2
fi
echo "prepCohereOnClient.sh: Successfully generated embeddings for library $LIBRARY_ID"
else
echo "Error Response:"
echo "$RESPONSE"
echo "prepCohereOnClient.sh: Failed to generate embeddings for library $LIBRARY_ID"
fi
done