-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from alea-institute/v0.1.5
merge V0.1.5 onto master
- Loading branch information
Showing
10 changed files
with
1,001 additions
and
632 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,55 @@ | ||
import asyncio | ||
import time | ||
from pathlib import Path | ||
from soli import SOLI | ||
from alea_llm_client import OpenAIModel, AnthropicModel | ||
|
||
|
||
async def main(): | ||
# text to label/classify | ||
example_text = "review and revise license agreement" | ||
|
||
# set at initialization | ||
g = SOLI(llm=OpenAIModel(model="gpt-4o")) | ||
|
||
print("gpt-4o results:") | ||
for x in await g.parallel_search_by_llm( | ||
example_text, | ||
): | ||
print(x) | ||
|
||
# use a small llama model for area of law | ||
TOGETHER_API_KEY = (Path.home() / ".alea" / "keys" / "together").read_text().strip() | ||
g.llm = OpenAIModel( | ||
endpoint="https://api.together.xyz", | ||
model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", | ||
api_key=TOGETHER_API_KEY, | ||
) | ||
|
||
print("\n\nmeta-llama/Llama-3.2-3B-Instruct-Turbo results:") | ||
for x in await g.search_by_llm( | ||
example_text, | ||
search_set=g.get_areas_of_law(max_depth=1), | ||
): | ||
print(x) | ||
|
||
# override via property | ||
g.llm = AnthropicModel(model="claude-3-5-haiku-20241022") | ||
|
||
# search specific branches | ||
print("\n\nclaude-3-5-haiku-20241022 results:") | ||
for x in await g.parallel_search_by_llm( | ||
example_text, | ||
search_sets=[ | ||
g.get_areas_of_law(max_depth=2), | ||
g.get_document_artifacts(max_depth=2), | ||
g.get_player_actors(max_depth=3), | ||
], | ||
): | ||
print(x) | ||
|
||
|
||
if __name__ == "__main__": | ||
t0 = time.time() | ||
asyncio.run(main()) | ||
print(time.time() - t0) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "soli-python" | ||
version = "0.1.4" | ||
version = "0.1.5" | ||
description = "Python library for SOLI, the Standard for Open Legal Information" | ||
authors = ["ALEA Institute <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -39,9 +39,9 @@ python = ">=3.10,<4.0.0" | |
pydantic = "^2.8.2" | ||
lxml = "^5.2.2" | ||
httpx = "^0.27.2" | ||
rapidfuzz = {version = "^3.9.7", optional = true} | ||
rapidfuzz = {version = "^3.10.0", optional = true} | ||
marisa-trie = {version = "^1.2.0", optional = true} | ||
|
||
alea-llm-client = {version = "^0.1.1", optional = true} | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
types-lxml = "^2024.8.7" | ||
|
@@ -62,10 +62,11 @@ sphinx-plausible = "^0.1.2" | |
[tool.poetry.group.search.dependencies] | ||
rapidfuzz = "^3.9.7" | ||
marisa-trie = "^1.2.0" | ||
alea-llm-client = "^0.1.1" | ||
|
||
# extras | ||
[tool.poetry.extras] | ||
search = ["rapidfuzz", "marisa-trie"] | ||
search = ["rapidfuzz", "marisa-trie", "alea-llm-client"] | ||
|
||
|
||
[build-system] | ||
|
This file contains 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
Oops, something went wrong.