Skip to content

Commit

Permalink
Add Gemini LLM and Summarizer (#1176)
Browse files Browse the repository at this point in the history
* add gemini

* add gemini

* add gemini

* update lockfile and respond to comments

* move types imports out

* updates and fixes

* requires nit

* remove print

* move to ubuntu-latest
  • Loading branch information
karanataryn authored Feb 17, 2025
1 parent d85b4e9 commit 21c3fc0
Show file tree
Hide file tree
Showing 16 changed files with 548 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/aryn-sdk_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
jobs:
release:
name: Upload to PyPI
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/aryn-sdk/
Expand All @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: useblacksmith/setup-python@v6
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:

jobs:
analyze:
runs-on: 'blacksmith'
runs-on: 'ubuntu-latest'
permissions:
# required for all workflows
security-events: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:

jobs:
dependency-review:
runs-on: blacksmith
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doclint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
doclint:
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ permissions:

jobs:
draft-release:
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: useblacksmith/setup-python@v6
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'poetry'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
# specific.
jobs:
mypy:
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: DF-1
run: df -h
Expand All @@ -29,7 +29,7 @@ jobs:
run: df -h
- name: Install poetry
run: pipx install poetry
- uses: useblacksmith/setup-python@v6
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
Expand All @@ -45,13 +45,13 @@ jobs:
poetry run mypy --install-types --non-interactive .
lint:
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: useblacksmith/setup-python@v6
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
test-pypi-release:
name: Upload to PyPI
runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/sycamore-ai/
Expand All @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: useblacksmith/setup-python@v6
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
SYCAMORE_S3_TEMP_PATH: s3://aryn-sycamore-integ-temp/
MODEL_SERVER_KEY: ${{ secrets.MODEL_SERVER_KEY }}
Expand All @@ -30,7 +31,7 @@ permissions:

jobs:
sycamore-unit-tests:
runs-on: blacksmith-8vcpu-ubuntu-2204
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
Expand All @@ -53,7 +54,7 @@ jobs:
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: useblacksmith/setup-python@v6
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
Expand Down
97 changes: 96 additions & 1 deletion lib/sycamore/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/sycamore/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ nltk = { version = "^3.9.0", optional = true }

# LLM Dependencies
anthropic = { version = "^0.42.0", optional = true }
google-genai = {version = "^1.0", optional = true}
tiktoken = "^0.8.0"

[tool.poetry.group.test.dependencies]
Expand Down Expand Up @@ -143,6 +144,7 @@ legacy-partitioners = ["unstructured", "python-pptx", "nltk"]

# LLM extras
anthropic = ["anthropic"]
google-genai = ["google-genai"]

[tool.ruff]
line-length = 120
Expand Down
4 changes: 4 additions & 0 deletions lib/sycamore/sycamore/llms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sycamore.llms.openai import OpenAI, OpenAIClientType, OpenAIModels, OpenAIClientParameters, OpenAIClientWrapper
from sycamore.llms.bedrock import Bedrock, BedrockModels
from sycamore.llms.anthropic import Anthropic, AnthropicModels
from sycamore.llms.gemini import Gemini, GeminiModels

# Register the model constructors.
MODELS: Dict[str, Callable[..., LLM]] = {}
Expand All @@ -16,6 +17,7 @@
MODELS.update(
{f"anthropic.{model.value}": lambda **kwargs: Anthropic(model.value, **kwargs) for model in AnthropicModels}
)
MODELS.update({f"gemini.{model.value}": lambda **kwargs: Gemini(model.value.name, **kwargs) for model in GeminiModels})


def get_llm(model_name: str) -> Callable[..., LLM]:
Expand All @@ -38,4 +40,6 @@ def get_llm(model_name: str) -> Callable[..., LLM]:
"BedrockModels",
"Anthropic",
"AnthropicModels",
"Gemini",
"GeminiModels",
]
Loading

0 comments on commit 21c3fc0

Please sign in to comment.