[Improvements] Upgrade langchain-openai package and other improvements (#1372)

This commit is contained in:
Deshraj Yadav
2024-05-21 23:42:50 -07:00
committed by GitHub
parent 9ba445e623
commit 9544c69c55
9 changed files with 86 additions and 232 deletions

View File

@@ -10,6 +10,7 @@ from embedchain.llm.openai import OpenAILlm
@pytest.fixture
def config():
os.environ["OPENAI_API_KEY"] = "test_api_key"
os.environ["OPENAI_API_BASE"] = "https://api.openai.com/v1/engines/"
config = BaseLlmConfig(
temperature=0.7, max_tokens=50, top_p=0.8, stream=False, system_prompt="System prompt", model="gpt-3.5-turbo"
)
@@ -76,8 +77,9 @@ def test_get_llm_model_answer_without_system_prompt(config, mocker):
base_url=os.environ["OPENAI_API_BASE"],
)
def test_get_llm_model_answer_with_special_headers(config, mocker):
config.default_headers = {'test': 'test'}
config.default_headers = {"test": "test"}
mocked_openai_chat = mocker.patch("embedchain.llm.openai.ChatOpenAI")
llm = OpenAILlm(config)
@@ -90,7 +92,7 @@ def test_get_llm_model_answer_with_special_headers(config, mocker):
model_kwargs={"top_p": config.top_p},
api_key=os.environ["OPENAI_API_KEY"],
base_url=os.environ["OPENAI_API_BASE"],
default_headers={'test': 'test'}
default_headers={"test": "test"},
)