Skip to content

Commit

Permalink
chore: replace metadata w meta in tests/examples (#6612)
Browse files Browse the repository at this point in the history
* replace metadata w meta in tests/examples

* do not touch already broken e2e tests

* Revert "do not touch already broken e2e tests"

This reverts commit 1f91192.
  • Loading branch information
anakin87 authored Dec 21, 2023
1 parent 3d17e6f commit 7cc6080
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions e2e/pipelines/test_rag_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_bm25_rag_pipeline(tmp_path):
rag_pipeline.connect("retriever", "prompt_builder.documents")
rag_pipeline.connect("prompt_builder", "llm")
rag_pipeline.connect("llm.replies", "answer_builder.replies")
rag_pipeline.connect("llm.metadata", "answer_builder.metadata")
rag_pipeline.connect("llm.meta", "answer_builder.meta")
rag_pipeline.connect("retriever", "answer_builder.documents")

# Draw the pipeline
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_embedding_retrieval_rag_pipeline(tmp_path):
rag_pipeline.connect("retriever", "prompt_builder.documents")
rag_pipeline.connect("prompt_builder", "llm")
rag_pipeline.connect("llm.replies", "answer_builder.replies")
rag_pipeline.connect("llm.metadata", "answer_builder.metadata")
rag_pipeline.connect("llm.meta", "answer_builder.meta")
rag_pipeline.connect("retriever", "answer_builder.documents")

# Draw the pipeline
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines/rag_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
rag_pipeline.connect("retriever", "prompt_builder.documents")
rag_pipeline.connect("prompt_builder", "llm")
rag_pipeline.connect("llm.replies", "answer_builder.replies")
rag_pipeline.connect("llm.metadata", "answer_builder.metadata")
rag_pipeline.connect("llm.meta", "answer_builder.meta")
rag_pipeline.connect("retriever", "answer_builder.documents")

# Ask a question on the data you just added.
Expand Down
8 changes: 4 additions & 4 deletions test/components/generators/chat/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ def test_live_run(self):
assert len(results["replies"]) == 1
message: ChatMessage = results["replies"][0]
assert "Paris" in message.content
assert "gpt-3.5" in message.metadata["model"]
assert message.metadata["finish_reason"] == "stop"
assert "gpt-3.5" in message.meta["model"]
assert message.meta["finish_reason"] == "stop"

@pytest.mark.skipif(
not os.environ.get("OPENAI_API_KEY", None),
Expand Down Expand Up @@ -311,8 +311,8 @@ def __call__(self, chunk: StreamingChunk) -> None:
message: ChatMessage = results["replies"][0]
assert "Paris" in message.content

assert "gpt-3.5" in message.metadata["model"]
assert message.metadata["finish_reason"] == "stop"
assert "gpt-3.5" in message.meta["model"]
assert message.meta["finish_reason"] == "stop"

assert callback.counter > 1
assert "Paris" in callback.responses
8 changes: 4 additions & 4 deletions test/components/generators/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ def test_live_run(self):
component = GPTGenerator(api_key=os.environ.get("OPENAI_API_KEY"))
results = component.run("What's the capital of France?")
assert len(results["replies"]) == 1
assert len(results["metadata"]) == 1
assert len(results["meta"]) == 1
response: str = results["replies"][0]
assert "Paris" in response

metadata = results["metadata"][0]
metadata = results["meta"][0]
assert "gpt-3.5" in metadata["model"]
assert metadata["finish_reason"] == "stop"

Expand Down Expand Up @@ -314,11 +314,11 @@ def __call__(self, chunk: StreamingChunk) -> None:
results = component.run("What's the capital of France?")

assert len(results["replies"]) == 1
assert len(results["metadata"]) == 1
assert len(results["meta"]) == 1
response: str = results["replies"][0]
assert "Paris" in response

metadata = results["metadata"][0]
metadata = results["meta"][0]

assert "gpt-3.5" in metadata["model"]
assert metadata["finish_reason"] == "stop"
Expand Down

0 comments on commit 7cc6080

Please sign in to comment.