Skip to content

Commit

Permalink
fix curl command format in readme and test (opea-project#110)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Spycsh and pre-commit-ci[bot] committed May 29, 2024
1 parent cae346d commit d9c4441
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 3 additions & 10 deletions comps/retrievers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```
4 changes: 1 addition & 3 deletions tests/test_retrievers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down

0 comments on commit d9c4441

Please sign in to comment.