Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rai220 committed Oct 7, 2024
1 parent cfc1908 commit 006c350
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def _test_no_stream(**kwargs: Any) -> None:
import openai

result = openai.ChatCompletion.create(**kwargs)
result = openai.ChatCompletion.create(**kwargs) # type: ignore
lc_result = lcopenai.ChatCompletion.create(**kwargs)
if isinstance(lc_result, dict):
if isinstance(result, dict):
Expand All @@ -20,7 +20,7 @@ def _test_stream(**kwargs: Any) -> None:
import openai

result = []
for c in openai.ChatCompletion.create(**kwargs):
for c in openai.ChatCompletion.create(**kwargs): # type: ignore
result.append(c["choices"][0]["delta"].to_dict_recursive())

lc_result = []
Expand All @@ -32,7 +32,7 @@ def _test_stream(**kwargs: Any) -> None:
async def _test_async(**kwargs: Any) -> None:
import openai

result = await openai.ChatCompletion.acreate(**kwargs)
result = await openai.ChatCompletion.acreate(**kwargs) # type: ignore
lc_result = await lcopenai.ChatCompletion.acreate(**kwargs)
if isinstance(lc_result, dict):
if isinstance(result, dict):
Expand All @@ -46,7 +46,7 @@ async def _test_astream(**kwargs: Any) -> None:
import openai

result = []
async for c in await openai.ChatCompletion.acreate(**kwargs):
async for c in await openai.ChatCompletion.acreate(**kwargs): # type: ignore
result.append(c["choices"][0]["delta"].to_dict_recursive())

lc_result = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def test_chain(model_name: str, question: str) -> None:
"FROM <https://swapi.co/ontology/> WHERE {?s ?p ?o}",
)
chain = OntotextGraphDBQAChain.from_llm(
ChatOpenAI(temperature=0, model_name=model_name),
ChatOpenAI(temperature=0, model=model_name),
graph=graph,
verbose=True, # type: ignore[call-arg]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_azure_openai_embedding_with_empty_string() -> None:
output = embedding.embed_documents(document)
assert len(output) == 2
assert len(output[0]) == 1536
expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[
expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[ # type: ignore
"data"
][0]["embedding"]
assert np.allclose(output[0], expected_output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_openai_embedding_with_empty_string() -> None:
output = embedding.embed_documents(document)
assert len(output) == 2
assert len(output[0]) == 1536
expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[
expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[ # type: ignore
"data"
][0]["embedding"]
assert np.allclose(output[0], expected_output)
Expand Down

0 comments on commit 006c350

Please sign in to comment.