Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,4 @@ azure_storage_blobs = { version = "0.21.0", default-features = false, features =
"hmac_rust",
] }
serde_path_to_error = "0.1.17"
expect-test = "1.5.0"
1 change: 1 addition & 0 deletions python/cocoindex/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class EmbedText(op.FunctionSpec):
output_dimension: int | None = None
task_type: str | None = None
api_config: llm.VertexAiConfig | None = None
api_key: str | None = None


class ExtractByLlm(op.FunctionSpec):
Expand Down
1 change: 1 addition & 0 deletions python/cocoindex/functions/_engine_builtin_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class EmbedText(op.FunctionSpec):
output_dimension: int | None = None
task_type: str | None = None
api_config: llm.VertexAiConfig | None = None
api_key: str | None = None


class ExtractByLlm(op.FunctionSpec):
Expand Down
57 changes: 56 additions & 1 deletion python/cocoindex/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,61 @@ class OpenAiConfig:

org_id: str | None = None
project_id: str | None = None
api_key: str | None = None


@dataclass
class AnthropicConfig:
"""A specification for an Anthropic LLM."""

kind = "Anthropic"

api_key: str | None = None


@dataclass
class GeminiConfig:
"""A specification for a Gemini LLM."""

kind = "Gemini"

api_key: str | None = None


@dataclass
class VoyageConfig:
"""A specification for a Voyage LLM."""

kind = "Voyage"

api_key: str | None = None


@dataclass
class LiteLlmConfig:
"""A specification for a LiteLLM LLM."""

kind = "LiteLlm"

api_key: str | None = None


@dataclass
class OpenRouterConfig:
"""A specification for an OpenRouter LLM."""

kind = "OpenRouter"

api_key: str | None = None


@dataclass
class VllmConfig:
"""A specification for a VLLM LLM."""

kind = "Vllm"

api_key: str | None = None


@dataclass
Expand All @@ -43,4 +98,4 @@ class LlmSpec:
api_type: LlmApiType
model: str
address: str | None = None
api_config: VertexAiConfig | OpenAiConfig | None = None
api_config: VertexAiConfig | OpenAiConfig | AnthropicConfig | GeminiConfig | VoyageConfig | LiteLlmConfig | OpenRouterConfig | VllmConfig | None = None
Loading
Loading