Skip to content

Commit 00f0df2

Browse files
committed
feat(vertex): support Vertex AI for generation
1 parent 44e1517 commit 00f0df2

File tree

9 files changed

+412
-16
lines changed

9 files changed

+412
-16
lines changed

Cargo.lock

Lines changed: 242 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ tree-sitter-typescript = "0.23.2"
9191
tree-sitter-xml = "0.7.0"
9292
tree-sitter-yaml = "0.7.0"
9393

94-
globset = "0.4.16"
95-
unicase = "2.8.1"
96-
google-drive3 = "6.0.0"
97-
hyper-util = "0.1.11"
98-
hyper-rustls = { version = "0.27.5" }
99-
yup-oauth2 = "12.1.0"
94+
yup-oauth2 = { version = "12.1.0" }
10095
rustls = { version = "0.23.25" }
10196
http-body-util = "0.1.3"
10297
yaml-rust2 = "0.10.1"
@@ -117,3 +112,9 @@ aws-sdk-sqs = "1.67.0"
117112
numpy = "0.25.0"
118113
infer = "0.19.0"
119114
serde_with = { version = "3.13.0", features = ["base64"] }
115+
globset = "0.4.16"
116+
unicase = "2.8.1"
117+
google-drive3 = "6.0.0"
118+
hyper-util = "0.1.11"
119+
hyper-rustls = { version = "0.27.5" }
120+
google-cloud-aiplatform-v1 = "0.4.0"

python/cocoindex/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# Submodules
3434
"_engine",
3535
"functions",
36+
"llm",
3637
"sources",
3738
"targets",
3839
"storages",

python/cocoindex/functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class EmbedText(op.FunctionSpec):
4545
address: str | None = None
4646
output_dimension: int | None = None
4747
task_type: str | None = None
48+
api_config: llm.VertexAiConfig | None = None
4849

4950

5051
class ExtractByLlm(op.FunctionSpec):

python/cocoindex/llm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,29 @@ class LlmApiType(Enum):
88
OPENAI = "OpenAi"
99
OLLAMA = "Ollama"
1010
GEMINI = "Gemini"
11+
VERTEX_AI = "VertexAi"
1112
ANTHROPIC = "Anthropic"
1213
LITE_LLM = "LiteLlm"
1314
OPEN_ROUTER = "OpenRouter"
1415
VOYAGE = "Voyage"
1516
VLLM = "Vllm"
1617

1718

19+
@dataclass
20+
class VertexAiConfig:
21+
"""A specification for a Vertex AI LLM."""
22+
23+
kind = "VertexAi"
24+
25+
project: str
26+
location: str | None = None
27+
28+
1829
@dataclass
1930
class LlmSpec:
2031
"""A specification for a LLM."""
2132

2233
api_type: LlmApiType
2334
model: str
2435
address: str | None = None
36+
api_config: VertexAiConfig | None = None

0 commit comments

Comments
 (0)