diff --git a/comps/retrievers/README.md b/comps/retrievers/README.md index bad388f1f..38f64f33e 100644 --- a/comps/retrievers/README.md +++ b/comps/retrievers/README.md @@ -108,19 +108,12 @@ curl http://localhost:7000/v1/health_check \ ## 3.2 Consume Embedding Service -To consume the Retriever Microservice, you need to generate a mock embedding vector of length 768 in Python script: - -```Python -import random -embedding = [random.uniform(-1, 1) for _ in range(768)] -print(embedding) -``` - -Then substitute your mock embedding vector for the `${your_embedding}` in the following `curl` command: +To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. ```bash +your_embedding=$(python -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") curl http://${your_ip}:7000/v1/retrieval \ -X POST \ - -d '{"text":"What is the revenue of Nike in 2023?","embedding":${your_embedding}}' \ + -d "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${your_embedding}}" \ -H 'Content-Type: application/json' ``` diff --git a/tests/test_retrievers.sh b/tests/test_retrievers.sh index 97f8ca7a3..57c611545 100644 --- a/tests/test_retrievers.sh +++ b/tests/test_retrievers.sh @@ -33,12 +33,10 @@ function validate_microservice() { retriever_port=5009 export PATH="${HOME}/miniforge3/bin:$PATH" source activate - sleep 1s test_embedding=$(python -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") - sleep 1s http_proxy='' curl http://${ip_address}:$retriever_port/v1/retrieval \ -X POST \ - -d '{"text":"test","embedding":${test_embedding}}' \ + -d "{\"text\":\"test\",\"embedding\":${test_embedding}}" \ -H 'Content-Type: application/json' }