Skip to content

Commit

Permalink
Embed openai broad multimodal compat (#395)
Browse files Browse the repository at this point in the history
* inital commit

* add openapi

* fix openapi

* add poetry lock

* re iterate on Modality dtype

* commit wrt to makefile, run_test.sh scripts

* re iterate on cli
  • Loading branch information
michaelfeil authored Oct 5, 2024
1 parent 3de8ea7 commit 2ff39c6
Show file tree
Hide file tree
Showing 37 changed files with 1,672 additions and 498 deletions.
33 changes: 33 additions & 0 deletions docs/assets/create_cli_v2_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

echo 'Generating CLI v2 documentation...'

# Get the directory of the script
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Define the output file path relative to the script's location
OUTPUT_FILE="$SCRIPT_DIR/../docs/cli_v2.md"

# Ensure the output directory exists
mkdir -p "$(dirname "$OUTPUT_FILE")"

# Write the static content to the output file
cat << EOF > "$OUTPUT_FILE"
# CLI v2 Documentation
The current version of Infinity uses the following arguments in its CLI:
\`\`\`bash
\$ infinity_emb v2 --help
\`\`\`
\`\`\`
EOF

# Append the help output to the file, setting COLUMNS=80 only for this command
TERMINAL_WIDTH=120 poetry run infinity_emb v2 --help >> "$OUTPUT_FILE" 2>&1

# Close the code block in the markdown file
echo '```' >> "$OUTPUT_FILE"
echo 'Note: This doc is auto-generated. Do not edit this file directly.' >> "$OUTPUT_FILE"

echo "CLI v2 documentation generated and saved to $OUTPUT_FILE."
35 changes: 35 additions & 0 deletions docs/assets/create_openapi_with_server_hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Function to handle cleanup
cleanup() {
echo "Cleaning up..."
if [[ -n "${INFINITY_PID:-}" ]]; then
kill "$INFINITY_PID"
fi
}

# Set up the trap to run the cleanup function on EXIT or any error
trap cleanup EXIT

# Start infinity_emb in the background
infinity_emb v2 --log-level error --engine debugengine &
INFINITY_PID=$!
echo "infinity_emb started with PID $INFINITY_PID"

# Wait for infinity_emb to be ready
for i in {1..10}; do
if wget -q --spider http://0.0.0.0:7997/openapi.json; then
echo "infinity_emb is ready."
break
else
echo "Waiting for infinity_emb to be ready..."
sleep 1
fi
done

# Download the openapi.json
wget http://0.0.0.0:7997/openapi.json -O "$SCRIPT_DIR/openapi.json"
2 changes: 1 addition & 1 deletion docs/assets/openapi.json

Large diffs are not rendered by default.

186 changes: 146 additions & 40 deletions docs/docs/cli_v2.md

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions libs/client_infinity/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
.PHONY: generate tests

generate:
pip install openapi-python-client==0.21.1
openapi-python-client generate \
--url http://0.0.0.0:7997/openapi.json \
--config client_config.yaml \
--overwrite \
--custom-template-path=./template
./run_generate_with_hook.sh

tests:
./run_tests_with_hook.sh
Loading

0 comments on commit 2ff39c6

Please sign in to comment.