Skip to content

Commit

Permalink
use random sentence in benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
samos123 committed Oct 29, 2023
1 parent 422a858 commit 63cc4ea
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion benchmarks/locustfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import random


from locust import HttpUser, task


def random_sentence() -> str:
subjects = ["I", "You", "Bob", "Sue", "We", "Sam", "Nick", "Bob"]
verbs = ["eat", "make", "read", "write", "create", "code"]
objects = [
"a book",
"the homework",
"a poem",
"a song",
"an email",
"some software",
]

return f"{random.choice(subjects)} {random.choice(verbs)} {random.choice(objects)}."


class EmbeddingUser(HttpUser):
@task
def get_embeddings(self):
sentence = random_sentence()
embedding_request = {
"input": "substratus.ai has some great LLM OSS projects for K8s",
"input": sentence,
"model": "ignored",
}
self.client.post("/v1/embeddings", json=embedding_request)

0 comments on commit 63cc4ea

Please sign in to comment.