langchain/libs/partners/together/tests/unit_tests/test_embeddings.py
Hassan El Mghari d6ef5fe86a
together: add chat models, use openai base (#21337)
**Description:** Adding chat completions to the Together AI package,
which is our most popular API. Also staying backwards compatible with
the old API so folks can continue to use the completions API as well.
Also moved the embedding API to use the OpenAI library to standardize it
further.

**Twitter handle:** @nutlope

- [x] **Add tests and docs**: If you're adding a new integration, please
include
- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, hwchase17.

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-05-06 17:47:06 -07:00

26 lines
603 B
Python

"""Test embedding model integration."""
import os
import pytest
from langchain_together import TogetherEmbeddings
os.environ["TOGETHER_API_KEY"] = "foo"
def test_initialization() -> None:
"""Test embedding model initialization."""
TogetherEmbeddings()
def test_together_invalid_model_kwargs() -> None:
with pytest.raises(ValueError):
TogetherEmbeddings(model_kwargs={"model": "foo"})
def test_together_incorrect_field() -> None:
with pytest.warns(match="not default parameter"):
llm = TogetherEmbeddings(foo="bar")
assert llm.model_kwargs == {"foo": "bar"}