Skip to content
Draft

v0 #4057

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/llama_stack/apis/vector_io/vector_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class VectorStoreSearchResponsePage(BaseModel):
"""

object: str = "vector_store.search_results.page"
search_query: str
search_query: str | list[str]
data: list[VectorStoreSearchResponse]
has_more: bool = False
next_page: str | None = None
Expand Down
25 changes: 25 additions & 0 deletions src/llama_stack/providers/inline/vector_io/openai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

from typing import Any

from llama_stack.providers.datatypes import Api

from .config import OpenAIVectorIOConfig


async def get_provider_impl(config: OpenAIVectorIOConfig, deps: dict[Api, Any]):
from .openai import OpenAIVectorIOAdapter

assert isinstance(config, OpenAIVectorIOConfig), f"Unexpected config type: {type(config)}"

impl = OpenAIVectorIOAdapter(
config,
deps[Api.inference],
deps.get(Api.files),
)
await impl.initialize()
return impl
33 changes: 33 additions & 0 deletions src/llama_stack/providers/inline/vector_io/openai/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

from typing import Any

from pydantic import BaseModel, Field

from llama_stack.core.storage.datatypes import KVStoreReference
from llama_stack.schema_utils import json_schema_type


@json_schema_type
class OpenAIVectorIOConfig(BaseModel):
api_key: str | None = Field(
None,
description="OpenAI API key. If not provided, will use OPENAI_API_KEY environment variable.",
)
persistence: KVStoreReference = Field(
description="KVStore reference for persisting vector store metadata.",
)

@classmethod
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> dict[str, Any]:
return {
"api_key": "${OPENAI_API_KEY}",
"persistence": KVStoreReference(
backend="kv_default",
namespace="vector_io::openai",
).model_dump(exclude_none=True),
}
Loading
Loading