Skip to content

Embeddings

Create embedding vector representations for input text

from r9s import R9S
with R9S(api_key=os.getenv("R9S_API_KEY",""),) as r9_s:
res = r9_s.embeddings.create(model="qwen-plus", input="The food was delicious and the waiter was friendly.", encoding_format="float")
# Handle response
print(res)
ParameterTypeRequiredDescription
modelstr:heavy_check_mark:Model name
inputstring or Array:heavy_check_mark:Input text
encoding_formatstring (float, base64):heavy_minus_sign:N/A
dimensionsint:heavy_minus_sign:Output dimensions
userstr:heavy_minus_sign:N/A
retriesobject:heavy_minus_sign:Configuration to override the default retry behavior of the client.

EmbeddingResponse

Error TypeStatus CodeContent Type
errors.BadRequestError400application/json
errors.AuthenticationError401application/json
errors.PermissionDeniedError403application/json
errors.UnprocessableEntityError422application/json
errors.RateLimitError429application/json
errors.InternalServerError500application/json
errors.ServiceUnavailableError503application/json
errors.R9SDefaultError4XX, 5XX*/*