Add Together.ai's OpenAI API-compatible inference endpoints (#1947)

This commit is contained in:
Chenhe Gu 2024-01-05 16:36:29 +08:00 committed by GitHub
commit 6075fee556
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 307 additions and 101 deletions

View file

@ -46,14 +46,16 @@ def test_invoke_model():
},
texts=[
"hello",
"world"
"world",
" ".join(["long_text"] * 100),
" ".join(["another_long_text"] * 100)
],
user="abc-123"
)
assert isinstance(result, TextEmbeddingResult)
assert len(result.embeddings) == 2
assert result.usage.total_tokens == 2
assert len(result.embeddings) == 4
assert result.usage.total_tokens == 502
def test_get_num_tokens():