mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
linting and formatting
This commit is contained in:
parent
5aafb3bc46
commit
e276ae2616
@ -159,7 +159,7 @@ def test_default_embeddings():
|
|||||||
encoded_ctx_str_1 = encoded_text + " ".join(char for char in ctx_str_1)
|
encoded_ctx_str_1 = encoded_text + " ".join(char for char in ctx_str_1)
|
||||||
encoded_text + " ".join(char for char in ctx_str_2)
|
encoded_text + " ".join(char for char in ctx_str_2)
|
||||||
|
|
||||||
expected = f"""shared |User {ctx_str_1 + " " + encoded_ctx_str_1} \n|action {str1 + " " + encoded_str1} \n|action {str2 + " " + encoded_str2} \n|action {str3 + " " + encoded_str3} """
|
expected = f"""shared |User {ctx_str_1 + " " + encoded_ctx_str_1} \n|action {str1 + " " + encoded_str1} \n|action {str2 + " " + encoded_str2} \n|action {str3 + " " + encoded_str3} """ # noqa
|
||||||
|
|
||||||
actions = [str1, str2, str3]
|
actions = [str1, str2, str3]
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ def test_default_embeddings_off():
|
|||||||
str3 = "2"
|
str3 = "2"
|
||||||
ctx_str_1 = "context1"
|
ctx_str_1 = "context1"
|
||||||
|
|
||||||
expected = f"""shared |User {ctx_str_1} \n|action {str1} \n|action {str2} \n|action {str3} """
|
expected = f"""shared |User {ctx_str_1} \n|action {str1} \n|action {str2} \n|action {str3} """ # noqa
|
||||||
|
|
||||||
actions = [str1, str2, str3]
|
actions = [str1, str2, str3]
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ def test_default_embeddings_mixed_w_explicit_user_embeddings():
|
|||||||
encoded_ctx_str_1 = encoded_text + " ".join(char for char in ctx_str_1)
|
encoded_ctx_str_1 = encoded_text + " ".join(char for char in ctx_str_1)
|
||||||
encoded_ctx_str_2 = encoded_text + " ".join(char for char in ctx_str_2)
|
encoded_ctx_str_2 = encoded_text + " ".join(char for char in ctx_str_2)
|
||||||
|
|
||||||
expected = f"""shared |User {encoded_ctx_str_1} |User2 {ctx_str_2 + " " + encoded_ctx_str_2} \n|action {str1 + " " + encoded_str1} \n|action {str2 + " " + encoded_str2} \n|action {encoded_str3} """
|
expected = f"""shared |User {encoded_ctx_str_1} |User2 {ctx_str_2 + " " + encoded_ctx_str_2} \n|action {str1 + " " + encoded_str1} \n|action {str2 + " " + encoded_str2} \n|action {encoded_str3} """ # noqa
|
||||||
|
|
||||||
actions = [str1, str2, rl_chain.Embed(str3)]
|
actions = [str1, str2, rl_chain.Embed(str3)]
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ def test_pickbest_textembedder_w_full_label_w_emb():
|
|||||||
|
|
||||||
named_actions = {"action1": rl_chain.Embed([str1, str2, str3])}
|
named_actions = {"action1": rl_chain.Embed([str1, str2, str3])}
|
||||||
context = {"context": rl_chain.Embed(ctx_str_1)}
|
context = {"context": rl_chain.Embed(ctx_str_1)}
|
||||||
expected = f"""shared |context {encoded_ctx_str_1} \n0:-0.0:1.0 |action1 {encoded_str1} \n|action1 {encoded_str2} \n|action1 {encoded_str3} """
|
expected = f"""shared |context {encoded_ctx_str_1} \n0:-0.0:1.0 |action1 {encoded_str1} \n|action1 {encoded_str2} \n|action1 {encoded_str3} """ # noqa: E501
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
||||||
@ -113,7 +113,7 @@ def test_pickbest_textembedder_w_full_label_w_embed_and_keep():
|
|||||||
|
|
||||||
named_actions = {"action1": rl_chain.EmbedAndKeep([str1, str2, str3])}
|
named_actions = {"action1": rl_chain.EmbedAndKeep([str1, str2, str3])}
|
||||||
context = {"context": rl_chain.EmbedAndKeep(ctx_str_1)}
|
context = {"context": rl_chain.EmbedAndKeep(ctx_str_1)}
|
||||||
expected = f"""shared |context {ctx_str_1 + " " + encoded_ctx_str_1} \n0:-0.0:1.0 |action1 {str1 + " " + encoded_str1} \n|action1 {str2 + " " + encoded_str2} \n|action1 {str3 + " " + encoded_str3} """
|
expected = f"""shared |context {ctx_str_1 + " " + encoded_ctx_str_1} \n0:-0.0:1.0 |action1 {str1 + " " + encoded_str1} \n|action1 {str2 + " " + encoded_str2} \n|action1 {str3 + " " + encoded_str3} """ # noqa: E501
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
||||||
@ -127,7 +127,7 @@ def test_pickbest_textembedder_more_namespaces_no_label_no_emb():
|
|||||||
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
||||||
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
||||||
context = {"context1": "context1", "context2": "context2"}
|
context = {"context1": "context1", "context2": "context2"}
|
||||||
expected = """shared |context1 context1 |context2 context2 \n|a 0 |b 0 \n|action1 1 \n|action1 2 """
|
expected = """shared |context1 context1 |context2 context2 \n|a 0 |b 0 \n|action1 1 \n|action1 2 """ # noqa: E501
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context
|
inputs={}, to_select_from=named_actions, based_on=context
|
||||||
)
|
)
|
||||||
@ -140,7 +140,7 @@ def test_pickbest_textembedder_more_namespaces_w_label_no_emb():
|
|||||||
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
||||||
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
||||||
context = {"context1": "context1", "context2": "context2"}
|
context = {"context1": "context1", "context2": "context2"}
|
||||||
expected = """shared |context1 context1 |context2 context2 \n|a 0 |b 0 \n|action1 1 \n|action1 2 """
|
expected = """shared |context1 context1 |context2 context2 \n|a 0 |b 0 \n|action1 1 \n|action1 2 """ # noqa: E501
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
||||||
@ -154,7 +154,7 @@ def test_pickbest_textembedder_more_namespaces_w_full_label_no_emb():
|
|||||||
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
feature_embedder = pick_best_chain.PickBestFeatureEmbedder(model=MockEncoder())
|
||||||
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
named_actions = {"action1": [{"a": "0", "b": "0"}, "1", "2"]}
|
||||||
context = {"context1": "context1", "context2": "context2"}
|
context = {"context1": "context1", "context2": "context2"}
|
||||||
expected = """shared |context1 context1 |context2 context2 \n0:-0.0:1.0 |a 0 |b 0 \n|action1 1 \n|action1 2 """
|
expected = """shared |context1 context1 |context2 context2 \n0:-0.0:1.0 |a 0 |b 0 \n|action1 1 \n|action1 2 """ # noqa: E501
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
inputs={}, to_select_from=named_actions, based_on=context, selected=selected
|
||||||
@ -184,7 +184,7 @@ def test_pickbest_textembedder_more_namespaces_w_full_label_w_full_emb():
|
|||||||
"context1": rl_chain.Embed(ctx_str_1),
|
"context1": rl_chain.Embed(ctx_str_1),
|
||||||
"context2": rl_chain.Embed(ctx_str_2),
|
"context2": rl_chain.Embed(ctx_str_2),
|
||||||
}
|
}
|
||||||
expected = f"""shared |context1 {encoded_ctx_str_1} |context2 {encoded_ctx_str_2} \n0:-0.0:1.0 |a {encoded_str1} |b {encoded_str1} \n|action1 {encoded_str2} \n|action1 {encoded_str3} """
|
expected = f"""shared |context1 {encoded_ctx_str_1} |context2 {encoded_ctx_str_2} \n0:-0.0:1.0 |a {encoded_str1} |b {encoded_str1} \n|action1 {encoded_str2} \n|action1 {encoded_str3} """ # noqa: E501
|
||||||
|
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
@ -217,7 +217,7 @@ def test_pickbest_textembedder_more_namespaces_w_full_label_w_full_embed_and_kee
|
|||||||
"context1": rl_chain.EmbedAndKeep(ctx_str_1),
|
"context1": rl_chain.EmbedAndKeep(ctx_str_1),
|
||||||
"context2": rl_chain.EmbedAndKeep(ctx_str_2),
|
"context2": rl_chain.EmbedAndKeep(ctx_str_2),
|
||||||
}
|
}
|
||||||
expected = f"""shared |context1 {ctx_str_1 + " " + encoded_ctx_str_1} |context2 {ctx_str_2 + " " + encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1 + " " + encoded_str1} |b {str1 + " " + encoded_str1} \n|action1 {str2 + " " + encoded_str2} \n|action1 {str3 + " " + encoded_str3} """
|
expected = f"""shared |context1 {ctx_str_1 + " " + encoded_ctx_str_1} |context2 {ctx_str_2 + " " + encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1 + " " + encoded_str1} |b {str1 + " " + encoded_str1} \n|action1 {str2 + " " + encoded_str2} \n|action1 {str3 + " " + encoded_str3} """ # noqa: E501
|
||||||
|
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
@ -251,7 +251,7 @@ def test_pickbest_textembedder_more_namespaces_w_full_label_w_partial_emb():
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
context = {"context1": ctx_str_1, "context2": rl_chain.Embed(ctx_str_2)}
|
context = {"context1": ctx_str_1, "context2": rl_chain.Embed(ctx_str_2)}
|
||||||
expected = f"""shared |context1 {ctx_str_1} |context2 {encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1} |b {encoded_str1} \n|action1 {str2} \n|action1 {encoded_str3} """
|
expected = f"""shared |context1 {ctx_str_1} |context2 {encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1} |b {encoded_str1} \n|action1 {str2} \n|action1 {encoded_str3} """ # noqa: E501
|
||||||
|
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
@ -288,7 +288,7 @@ def test_pickbest_textembedder_more_namespaces_w_full_label_w_partial_embed_and_
|
|||||||
"context1": ctx_str_1,
|
"context1": ctx_str_1,
|
||||||
"context2": rl_chain.EmbedAndKeep(ctx_str_2),
|
"context2": rl_chain.EmbedAndKeep(ctx_str_2),
|
||||||
}
|
}
|
||||||
expected = f"""shared |context1 {ctx_str_1} |context2 {ctx_str_2 + " " + encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1} |b {str1 + " " + encoded_str1} \n|action1 {str2} \n|action1 {str3 + " " + encoded_str3} """
|
expected = f"""shared |context1 {ctx_str_1} |context2 {ctx_str_2 + " " + encoded_ctx_str_2} \n0:-0.0:1.0 |a {str1} |b {str1 + " " + encoded_str1} \n|action1 {str2} \n|action1 {str3 + " " + encoded_str3} """ # noqa: E501
|
||||||
|
|
||||||
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
selected = pick_best_chain.PickBest.Selected(index=0, probability=1.0, score=0.0)
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
@ -334,7 +334,7 @@ def test_raw_features_underscored():
|
|||||||
# Embeddings and raw features
|
# Embeddings and raw features
|
||||||
named_actions = {"action": rl_chain.EmbedAndKeep([str1])}
|
named_actions = {"action": rl_chain.EmbedAndKeep([str1])}
|
||||||
context = {"context": rl_chain.EmbedAndKeep(ctx_str)}
|
context = {"context": rl_chain.EmbedAndKeep(ctx_str)}
|
||||||
expected_embed_and_keep = f"""shared |context {ctx_str_underscored + " " + encoded_ctx_str} \n|action {str1_underscored + " " + encoded_str1} """
|
expected_embed_and_keep = f"""shared |context {ctx_str_underscored + " " + encoded_ctx_str} \n|action {str1_underscored + " " + encoded_str1} """ # noqa: E501
|
||||||
event = pick_best_chain.PickBest.Event(
|
event = pick_best_chain.PickBest.Event(
|
||||||
inputs={}, to_select_from=named_actions, based_on=context
|
inputs={}, to_select_from=named_actions, based_on=context
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user