mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
b2a11ce686
### Prem SDK integration in LangChain This PR adds the integration with [PremAI's](https://www.premai.io/) prem-sdk with langchain. User can now access to deployed models (llms/embeddings) and use it with langchain's ecosystem. This PR adds the following: ### This PR adds the following: - [x] Add chat support - [X] Adding embedding support - [X] writing integration tests - [X] writing tests for chat - [X] writing tests for embedding - [X] writing unit tests - [X] writing tests for chat - [X] writing tests for embedding - [X] Adding documentation - [X] writing documentation for chat - [X] writing documentation for embedding - [X] run `make test` - [X] run `make lint`, `make lint_diff` - [X] Final checks (spell check, lint, format and overall testing) --------- Co-authored-by: Anindyadeep Sannigrahi <anindyadeepsannigrahi@Anindyadeeps-MacBook-Pro.local> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Erick Friis <erick@langchain.dev> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
29 lines
793 B
Python
29 lines
793 B
Python
"""Test EmbaasEmbeddings embeddings"""
|
|
|
|
import pytest
|
|
from langchain_core.pydantic_v1 import SecretStr
|
|
from pytest import CaptureFixture
|
|
|
|
from langchain_community.embeddings import PremAIEmbeddings
|
|
|
|
|
|
@pytest.mark.requires("premai")
|
|
def test_api_key_is_string() -> None:
|
|
llm = PremAIEmbeddings(
|
|
premai_api_key="secret-api-key", project_id=8, model="fake-model"
|
|
)
|
|
assert isinstance(llm.premai_api_key, SecretStr)
|
|
|
|
|
|
@pytest.mark.requires("premai")
|
|
def test_api_key_masked_when_passed_via_constructor(
|
|
capsys: CaptureFixture,
|
|
) -> None:
|
|
llm = PremAIEmbeddings(
|
|
premai_api_key="secret-api-key", project_id=8, model="fake-model"
|
|
)
|
|
print(llm.premai_api_key, end="") # noqa: T201
|
|
captured = capsys.readouterr()
|
|
|
|
assert captured.out == "**********"
|