Skip to content

Commit

Permalink
Merge branch 'main' into phil/astra-metadata-component
Browse files Browse the repository at this point in the history
  • Loading branch information
mieslep authored Nov 13, 2024
2 parents 742d602 + 563b90e commit 5fc6db5
Show file tree
Hide file tree
Showing 47 changed files with 1,374 additions and 4,009 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/py_autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: autofix.ci
on:
pull_request:
paths:
- "poetry.lock"
- "pyproject.toml"
- "src/backend/**"
- "**/*.py"
env:
POETRY_VERSION: "1.8.2"

Expand All @@ -14,7 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: install-pinned/ruff@9ebc31a5721a0fb034f915e4bbcb2ee6feeaecbc
- run: ruff check --fix-only .
- run: ruff format .
- name: "Setup Environment"
uses: ./.github/actions/setup-uv
- run: uv run ruff check --fix-only .
- run: uv run ruff format .
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
- name: Minimize uv cache
run: uv cache prune --ci
2 changes: 2 additions & 0 deletions .github/workflows/style-check-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Ruff Style Check
on:
pull_request:
types: [opened, synchronize, reopened, auto_merge_enabled]
paths:
- "**/*.py"



Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/typescript_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ jobs:
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]
# shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# shardTotal: [10]
shardIndex: [1]
shardTotal: [1]
env:
OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }}
STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }}
Expand Down Expand Up @@ -119,8 +121,8 @@ jobs:
max_attempts: 2
command: |
cd src/frontend
npx playwright test ${{ inputs.tests_folder }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
npx playwright test ${{ inputs.tests_folder }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2
# npx playwright test ${{ inputs.tests_folder }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
# npx playwright test ${{ inputs.tests_folder }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2

- name: Upload blob report to GitHub Actions Artifacts
if: always()
Expand Down
37 changes: 29 additions & 8 deletions src/backend/base/langflow/base/models/aws_constants.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
AWS_MODEL_IDs = [
# Amazon Titan Models
"amazon.titan-text-express-v1",
"amazon.titan-text-lite-v1",
"amazon.titan-text-premier-v1:0",
"amazon.titan-embed-text-v1",
"amazon.titan-embed-text-v2:0",
"amazon.titan-embed-image-v1",
"amazon.titan-image-generator-v1",
# Anthropic Models
"anthropic.claude-v2",
"anthropic.claude-v2:1",
"anthropic.claude-3-sonnet-20240229-v1:0",
"anthropic.claude-3-5-sonnet-20240620-v1:0",
"anthropic.claude-3-5-sonnet-20241022-v2:0",
"anthropic.claude-3-haiku-20240307-v1:0",
"anthropic.claude-3-5-haiku-20241022-v1:0",
"anthropic.claude-3-opus-20240229-v1:0",
"anthropic.claude-instant-v1",
# AI21 Labs Models
"ai21.jamba-instruct-v1:0",
"ai21.j2-mid-v1",
"ai21.j2-ultra-v1",
"ai21.jamba-1-5-large-v1:0",
"ai21.jamba-1-5-mini-v1:0",
# Cohere Models
"cohere.command-text-v14",
"cohere.command-light-text-v14",
"cohere.command-r-v1:0",
"cohere.command-r-plus-v1:0",
"cohere.embed-english-v3",
"cohere.embed-multilingual-v3",
# Meta Models
"meta.llama2-13b-chat-v1",
"meta.llama2-70b-chat-v1",
"meta.llama3-8b-instruct-v1:0",
"meta.llama3-70b-instruct-v1:0",
"meta.llama3-1-8b-instruct-v1:0",
"meta.llama3-1-70b-instruct-v1:0",
"meta.llama3-1-405b-instruct-v1:0",
"meta.llama3-2-1b-instruct-v1:0",
"meta.llama3-2-3b-instruct-v1:0",
"meta.llama3-2-11b-instruct-v1:0",
"meta.llama3-2-90b-instruct-v1:0",
# Mistral AI Models
"mistral.mistral-7b-instruct-v0:2",
"mistral.mixtral-8x7b-instruct-v0:1",
"mistral.mistral-large-2402-v1:0",
"mistral.mistral-large-2407-v1:0",
"mistral.mistral-small-2402-v1:0",
"stability.stable-diffusion-xl-v0",
"stability.stable-diffusion-xl-v1",
]

AWS_EMBEDDING_MODEL_IDS = [
# Amazon Titan Embedding Models
"amazon.titan-embed-text-v1",
"amazon.titan-embed-text-v2:0",
# Cohere Embedding Models
"cohere.embed-english-v3",
"cohere.embed-multilingual-v3",
]

AWS_REGIONS = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from langflow.base.models.aws_constants import AWS_REGIONS
from langflow.base.models.aws_constants import AWS_EMBEDDING_MODEL_IDS, AWS_REGIONS
from langflow.base.models.model import LCModelComponent
from langflow.field_typing import Embeddings
from langflow.inputs import SecretStrInput
Expand All @@ -15,7 +15,7 @@ class AmazonBedrockEmbeddingsComponent(LCModelComponent):
DropdownInput(
name="model_id",
display_name="Model Id",
options=["amazon.titan-embed-text-v1"],
options=AWS_EMBEDDING_MODEL_IDS,
value="amazon.titan-embed-text-v1",
),
SecretStrInput(
Expand Down
19 changes: 14 additions & 5 deletions src/backend/base/langflow/components/vectorstores/astradb_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ def build_vector_store(self):
)
raise ImportError(msg) from e

try:
if not self.setup_mode:
self.setup_mode = self._inputs["setup_mode"].options[0]

setup_mode_value = SetupMode[self.setup_mode.upper()]
except KeyError as e:
msg = f"Invalid setup mode: {self.setup_mode}"
raise ValueError(msg) from e

try:
vector_store = AstraDBGraphVectorStore(
embedding=self.embedding,
Expand All @@ -210,16 +219,16 @@ def build_vector_store(self):
token=self.token,
api_endpoint=self.api_endpoint,
namespace=self.namespace or None,
environment=parse_api_endpoint(self.api_endpoint).environment,
metric=self.metric,
environment=parse_api_endpoint(self.api_endpoint).environment if self.api_endpoint else None,
metric=self.metric or None,
batch_size=self.batch_size or None,
bulk_insert_batch_concurrency=self.bulk_insert_batch_concurrency or None,
bulk_insert_overwrite_concurrency=self.bulk_insert_overwrite_concurrency or None,
bulk_delete_concurrency=self.bulk_delete_concurrency or None,
setup_mode=SetupMode[self.setup_mode.upper()],
setup_mode=setup_mode_value,
pre_delete_collection=self.pre_delete_collection,
metadata_indexing_include=[s for s in self.metadata_indexing_include if s],
metadata_indexing_exclude=[s for s in self.metadata_indexing_exclude if s],
metadata_indexing_include=[s for s in self.metadata_indexing_include if s] or None,
metadata_indexing_exclude=[s for s in self.metadata_indexing_exclude if s] or None,
collection_indexing_policy=orjson.dumps(self.collection_indexing_policy)
if self.collection_indexing_policy
else None,
Expand Down
Loading

0 comments on commit 5fc6db5

Please sign in to comment.