-
Notifications
You must be signed in to change notification settings - Fork 12
fix: Integration tests #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
75e4d4e
fix: types
asafgardin 7242325
test: Added some integration tests
asafgardin 1525a0e
test: improvements
asafgardin cc7fbe1
test: test_paraphrase.py
asafgardin 52f300e
fix: doc
asafgardin 3d54cde
fix: removed unused comment
asafgardin 0197c8c
test: test_summarize.py
asafgardin d9c148e
test: Added tests for test_summarize_by_segment.py
asafgardin e644bd2
test: test_segmentation.py
asafgardin 1adb281
fix: file id in library response
asafgardin 3ad97e4
fix: example for library
asafgardin 0d03b19
Merge branch 'rc_2_0_0' into integration_tests
asafgardin 0eacdbb
ci: Add rc branch prefix trigger for integration tests (#43)
asafgardin dc88a83
fix: types
asafgardin e119340
test: Added some integration tests
asafgardin e7b461a
test: improvements
asafgardin dc18348
test: test_paraphrase.py
asafgardin 067497d
fix: doc
asafgardin a952acd
fix: removed unused comment
asafgardin 5d70399
test: test_summarize.py
asafgardin 3601984
test: Added tests for test_summarize_by_segment.py
asafgardin 85669a2
test: test_segmentation.py
asafgardin dfc1f77
fix: file id in library response
asafgardin 079b02e
fix: example for library
asafgardin ae67c6e
docs: docstrings
asafgardin 42505af
fix: question
asafgardin 224d8ce
fix: CR
asafgardin b2d7f44
Merge remote-tracking branch 'origin/integration_tests' into integrat…
asafgardin 93caebd
test: Added tests to segment type in embed
asafgardin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ on: | |
| push: | ||
| branches: | ||
| - main | ||
| - "rc_*" | ||
|
|
||
| env: | ||
| POETRY_VERSION: "1.7.1" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import pytest | ||
| from ai21 import AI21Client | ||
| from ai21.models import AnswerLength, Mode | ||
|
|
||
| _CONTEXT = ( | ||
| "Holland is a geographical region[2] and former province on the western coast of" | ||
| " the Netherlands. From the " | ||
| "10th to the 16th century, Holland proper was a unified political region within the Holy Roman Empire as a county " | ||
| "ruled by the counts of Holland. By the 17th century, the province of Holland had risen to become a maritime and " | ||
| "economic power, dominating the other provinces of the newly independent Dutch Republic." | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ids=[ | ||
| "when_answer_is_in_context", | ||
| "when_answer_not_in_context", | ||
| ], | ||
| argnames=["question", "is_answer_in_context", "expected_answer_type"], | ||
| argvalues=[ | ||
| ("When did Holland become an economic power?", True, str), | ||
| ("Is the ocean blue?", False, None), | ||
| ], | ||
| ) | ||
| def test_answer(question: str, is_answer_in_context: bool, expected_answer_type: type): | ||
| client = AI21Client() | ||
| response = client.answer.create( | ||
| context=_CONTEXT, | ||
| question=question, | ||
| answer_length=AnswerLength.LONG, | ||
| mode=Mode.FLEXIBLE, | ||
| ) | ||
|
|
||
| assert response.answer_in_context == is_answer_in_context | ||
| if is_answer_in_context: | ||
| assert isinstance(response.answer, str) | ||
| else: | ||
| assert response.answer is None |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.