mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-12 13:00:39 +00:00
Merge branch 'main' into delete_unused_imports
This commit is contained in:
commit
ac73c56698
84 changed files with 783 additions and 619 deletions
3
.github/workflows/unit-tests.yml
vendored
3
.github/workflows/unit-tests.yml
vendored
|
@ -33,7 +33,7 @@ jobs:
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: |
|
run: |
|
||||||
uv run --python ${{ matrix.python }} --with-editable . --with-editable ".[dev]" --with-editable ".[unit]" pytest --cov=llama_stack -s -v tests/unit/ --junitxml=pytest-report-${{ matrix.python }}.xml
|
uv run --python ${{ matrix.python }} --with-editable . --with-editable ".[dev]" --with-editable ".[unit]" pytest --cov=llama_stack -s -v tests/unit/ --junitxml=pytest-report-${{ matrix.python }}.xml --cov-report=html:htmlcov-${{ matrix.python }}
|
||||||
|
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
if: always()
|
if: always()
|
||||||
|
@ -43,4 +43,5 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
pytest-report-${{ matrix.python }}.xml
|
pytest-report-${{ matrix.python }}.xml
|
||||||
|
htmlcov-${{ matrix.python }}/
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,3 +22,4 @@ pyrightconfig.json
|
||||||
venv/
|
venv/
|
||||||
pytest-report.xml
|
pytest-report.xml
|
||||||
.coverage
|
.coverage
|
||||||
|
.python-version
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
3.10
|
|
|
@ -61,6 +61,7 @@ outlined on that page and do not file a public issue.
|
||||||
|
|
||||||
We use [uv](https://github.com/astral-sh/uv) to manage python dependencies and virtual environments.
|
We use [uv](https://github.com/astral-sh/uv) to manage python dependencies and virtual environments.
|
||||||
You can install `uv` by following this [guide](https://docs.astral.sh/uv/getting-started/installation/).
|
You can install `uv` by following this [guide](https://docs.astral.sh/uv/getting-started/installation/).
|
||||||
|
|
||||||
You can install the dependencies by running:
|
You can install the dependencies by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -70,6 +71,11 @@ uv pip install -e .
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You can pin a specific version of Python to use for `uv` by adding a `.python-version` file in the root project directory.
|
||||||
|
> Otherwise, `uv` will automatically select a Python version according to the `requires-python` section of the `pyproject.toml`.
|
||||||
|
> For more info, see the [uv docs around Python versions](https://docs.astral.sh/uv/concepts/python-versions/).
|
||||||
|
|
||||||
Note that you can create a dotenv file `.env` that includes necessary environment variables:
|
Note that you can create a dotenv file `.env` that includes necessary environment variables:
|
||||||
```
|
```
|
||||||
LLAMA_STACK_BASE_URL=http://localhost:8321
|
LLAMA_STACK_BASE_URL=http://localhost:8321
|
||||||
|
|
19
docs/_static/llama-stack-spec.html
vendored
19
docs/_static/llama-stack-spec.html
vendored
|
@ -4347,24 +4347,6 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Unique identifier for the tool call this response is for"
|
"description": "Unique identifier for the tool call this response is for"
|
||||||
},
|
},
|
||||||
"tool_name": {
|
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"brave_search",
|
|
||||||
"wolfram_alpha",
|
|
||||||
"photogen",
|
|
||||||
"code_interpreter"
|
|
||||||
],
|
|
||||||
"title": "BuiltinTool"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Name of the tool that was called"
|
|
||||||
},
|
|
||||||
"content": {
|
"content": {
|
||||||
"$ref": "#/components/schemas/InterleavedContent",
|
"$ref": "#/components/schemas/InterleavedContent",
|
||||||
"description": "The response content from the tool"
|
"description": "The response content from the tool"
|
||||||
|
@ -4374,7 +4356,6 @@
|
||||||
"required": [
|
"required": [
|
||||||
"role",
|
"role",
|
||||||
"call_id",
|
"call_id",
|
||||||
"tool_name",
|
|
||||||
"content"
|
"content"
|
||||||
],
|
],
|
||||||
"title": "ToolResponseMessage",
|
"title": "ToolResponseMessage",
|
||||||
|
|
12
docs/_static/llama-stack-spec.yaml
vendored
12
docs/_static/llama-stack-spec.yaml
vendored
|
@ -2943,17 +2943,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
description: >-
|
description: >-
|
||||||
Unique identifier for the tool call this response is for
|
Unique identifier for the tool call this response is for
|
||||||
tool_name:
|
|
||||||
oneOf:
|
|
||||||
- type: string
|
|
||||||
enum:
|
|
||||||
- brave_search
|
|
||||||
- wolfram_alpha
|
|
||||||
- photogen
|
|
||||||
- code_interpreter
|
|
||||||
title: BuiltinTool
|
|
||||||
- type: string
|
|
||||||
description: Name of the tool that was called
|
|
||||||
content:
|
content:
|
||||||
$ref: '#/components/schemas/InterleavedContent'
|
$ref: '#/components/schemas/InterleavedContent'
|
||||||
description: The response content from the tool
|
description: The response content from the tool
|
||||||
|
@ -2961,7 +2950,6 @@ components:
|
||||||
required:
|
required:
|
||||||
- role
|
- role
|
||||||
- call_id
|
- call_id
|
||||||
- tool_name
|
|
||||||
- content
|
- content
|
||||||
title: ToolResponseMessage
|
title: ToolResponseMessage
|
||||||
description: >-
|
description: >-
|
||||||
|
|
|
@ -117,13 +117,11 @@ class ToolResponseMessage(BaseModel):
|
||||||
|
|
||||||
:param role: Must be "tool" to identify this as a tool response
|
:param role: Must be "tool" to identify this as a tool response
|
||||||
:param call_id: Unique identifier for the tool call this response is for
|
:param call_id: Unique identifier for the tool call this response is for
|
||||||
:param tool_name: Name of the tool that was called
|
|
||||||
:param content: The response content from the tool
|
:param content: The response content from the tool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
role: Literal["tool"] = "tool"
|
role: Literal["tool"] = "tool"
|
||||||
call_id: str
|
call_id: str
|
||||||
tool_name: Union[BuiltinTool, str]
|
|
||||||
content: InterleavedContent
|
content: InterleavedContent
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import secrets
|
||||||
import string
|
import string
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, AsyncGenerator, Dict, List, Optional, Tuple, Union
|
from typing import AsyncGenerator, List, Optional, Union
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
@ -153,7 +153,6 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
messages.append(
|
messages.append(
|
||||||
ToolResponseMessage(
|
ToolResponseMessage(
|
||||||
call_id=response.call_id,
|
call_id=response.call_id,
|
||||||
tool_name=response.tool_name,
|
|
||||||
content=response.content,
|
content=response.content,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -181,6 +180,7 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
async def create_and_execute_turn(self, request: AgentTurnCreateRequest) -> AsyncGenerator:
|
async def create_and_execute_turn(self, request: AgentTurnCreateRequest) -> AsyncGenerator:
|
||||||
|
await self._initialize_tools(request.toolgroups)
|
||||||
async with tracing.span("create_and_execute_turn") as span:
|
async with tracing.span("create_and_execute_turn") as span:
|
||||||
span.set_attribute("session_id", request.session_id)
|
span.set_attribute("session_id", request.session_id)
|
||||||
span.set_attribute("agent_id", self.agent_id)
|
span.set_attribute("agent_id", self.agent_id)
|
||||||
|
@ -191,6 +191,7 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
yield chunk
|
yield chunk
|
||||||
|
|
||||||
async def resume_turn(self, request: AgentTurnResumeRequest) -> AsyncGenerator:
|
async def resume_turn(self, request: AgentTurnResumeRequest) -> AsyncGenerator:
|
||||||
|
await self._initialize_tools()
|
||||||
async with tracing.span("resume_turn") as span:
|
async with tracing.span("resume_turn") as span:
|
||||||
span.set_attribute("agent_id", self.agent_id)
|
span.set_attribute("agent_id", self.agent_id)
|
||||||
span.set_attribute("session_id", request.session_id)
|
span.set_attribute("session_id", request.session_id)
|
||||||
|
@ -219,8 +220,7 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
messages = await self.get_messages_from_turns(turns)
|
messages = await self.get_messages_from_turns(turns)
|
||||||
if is_resume:
|
if is_resume:
|
||||||
tool_response_messages = [
|
tool_response_messages = [
|
||||||
ToolResponseMessage(call_id=x.call_id, tool_name=x.tool_name, content=x.content)
|
ToolResponseMessage(call_id=x.call_id, content=x.content) for x in request.tool_responses
|
||||||
for x in request.tool_responses
|
|
||||||
]
|
]
|
||||||
messages.extend(tool_response_messages)
|
messages.extend(tool_response_messages)
|
||||||
last_turn = turns[-1]
|
last_turn = turns[-1]
|
||||||
|
@ -275,7 +275,6 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
sampling_params=self.agent_config.sampling_params,
|
sampling_params=self.agent_config.sampling_params,
|
||||||
stream=request.stream,
|
stream=request.stream,
|
||||||
documents=request.documents if not is_resume else None,
|
documents=request.documents if not is_resume else None,
|
||||||
toolgroups_for_turn=request.toolgroups if not is_resume else None,
|
|
||||||
):
|
):
|
||||||
if isinstance(chunk, CompletionMessage):
|
if isinstance(chunk, CompletionMessage):
|
||||||
output_message = chunk
|
output_message = chunk
|
||||||
|
@ -327,7 +326,6 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
sampling_params: SamplingParams,
|
sampling_params: SamplingParams,
|
||||||
stream: bool = False,
|
stream: bool = False,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: Optional[List[Document]] = None,
|
||||||
toolgroups_for_turn: Optional[List[AgentToolGroup]] = None,
|
|
||||||
) -> AsyncGenerator:
|
) -> AsyncGenerator:
|
||||||
# Doing async generators makes downstream code much simpler and everything amenable to
|
# Doing async generators makes downstream code much simpler and everything amenable to
|
||||||
# streaming. However, it also makes things complicated here because AsyncGenerators cannot
|
# streaming. However, it also makes things complicated here because AsyncGenerators cannot
|
||||||
|
@ -350,7 +348,6 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
sampling_params,
|
sampling_params,
|
||||||
stream,
|
stream,
|
||||||
documents,
|
documents,
|
||||||
toolgroups_for_turn,
|
|
||||||
):
|
):
|
||||||
if isinstance(res, bool):
|
if isinstance(res, bool):
|
||||||
return
|
return
|
||||||
|
@ -451,30 +448,19 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
sampling_params: SamplingParams,
|
sampling_params: SamplingParams,
|
||||||
stream: bool = False,
|
stream: bool = False,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: Optional[List[Document]] = None,
|
||||||
toolgroups_for_turn: Optional[List[AgentToolGroup]] = None,
|
|
||||||
) -> AsyncGenerator:
|
) -> AsyncGenerator:
|
||||||
# TODO: simplify all of this code, it can be simpler
|
|
||||||
toolgroup_args = {}
|
|
||||||
toolgroups = set()
|
|
||||||
for toolgroup in self.agent_config.toolgroups + (toolgroups_for_turn or []):
|
|
||||||
if isinstance(toolgroup, AgentToolGroupWithArgs):
|
|
||||||
tool_group_name, tool_name = self._parse_toolgroup_name(toolgroup.name)
|
|
||||||
toolgroups.add(tool_group_name)
|
|
||||||
toolgroup_args[tool_group_name] = toolgroup.args
|
|
||||||
else:
|
|
||||||
toolgroups.add(toolgroup)
|
|
||||||
|
|
||||||
tool_defs, tool_to_group = await self._get_tool_defs(toolgroups_for_turn)
|
|
||||||
if documents:
|
if documents:
|
||||||
await self.handle_documents(session_id, documents, input_messages, tool_defs)
|
await self.handle_documents(session_id, documents, input_messages)
|
||||||
|
|
||||||
session_info = await self.storage.get_session_info(session_id)
|
session_info = await self.storage.get_session_info(session_id)
|
||||||
# if the session has a memory bank id, let the memory tool use it
|
# if the session has a memory bank id, let the memory tool use it
|
||||||
if session_info and session_info.vector_db_id:
|
if session_info and session_info.vector_db_id:
|
||||||
if RAG_TOOL_GROUP not in toolgroup_args:
|
for tool_name in self.tool_name_to_args.keys():
|
||||||
toolgroup_args[RAG_TOOL_GROUP] = {"vector_db_ids": [session_info.vector_db_id]}
|
if tool_name == MEMORY_QUERY_TOOL:
|
||||||
else:
|
if "vector_db_ids" not in self.tool_name_to_args[tool_name]:
|
||||||
toolgroup_args[RAG_TOOL_GROUP]["vector_db_ids"].append(session_info.vector_db_id)
|
self.tool_name_to_args[tool_name]["vector_db_ids"] = [session_info.vector_db_id]
|
||||||
|
else:
|
||||||
|
self.tool_name_to_args[tool_name]["vector_db_ids"].append(session_info.vector_db_id)
|
||||||
|
|
||||||
output_attachments = []
|
output_attachments = []
|
||||||
|
|
||||||
|
@ -504,7 +490,7 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
async for chunk in await self.inference_api.chat_completion(
|
async for chunk in await self.inference_api.chat_completion(
|
||||||
self.agent_config.model,
|
self.agent_config.model,
|
||||||
input_messages,
|
input_messages,
|
||||||
tools=tool_defs,
|
tools=self.tool_defs,
|
||||||
tool_prompt_format=self.agent_config.tool_config.tool_prompt_format,
|
tool_prompt_format=self.agent_config.tool_config.tool_prompt_format,
|
||||||
response_format=self.agent_config.response_format,
|
response_format=self.agent_config.response_format,
|
||||||
stream=True,
|
stream=True,
|
||||||
|
@ -686,12 +672,9 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
) as span:
|
) as span:
|
||||||
tool_execution_start_time = datetime.now().astimezone().isoformat()
|
tool_execution_start_time = datetime.now().astimezone().isoformat()
|
||||||
tool_call = message.tool_calls[0]
|
tool_call = message.tool_calls[0]
|
||||||
tool_result = await execute_tool_call_maybe(
|
tool_result = await self.execute_tool_call_maybe(
|
||||||
self.tool_runtime_api,
|
|
||||||
session_id,
|
session_id,
|
||||||
tool_call,
|
tool_call,
|
||||||
toolgroup_args,
|
|
||||||
tool_to_group,
|
|
||||||
)
|
)
|
||||||
if tool_result.content is None:
|
if tool_result.content is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
@ -700,7 +683,6 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
result_messages = [
|
result_messages = [
|
||||||
ToolResponseMessage(
|
ToolResponseMessage(
|
||||||
call_id=tool_call.call_id,
|
call_id=tool_call.call_id,
|
||||||
tool_name=tool_call.tool_name,
|
|
||||||
content=tool_result.content,
|
content=tool_result.content,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -720,7 +702,7 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
tool_responses=[
|
tool_responses=[
|
||||||
ToolResponse(
|
ToolResponse(
|
||||||
call_id=result_message.call_id,
|
call_id=result_message.call_id,
|
||||||
tool_name=result_message.tool_name,
|
tool_name=tool_call.tool_name,
|
||||||
content=result_message.content,
|
content=result_message.content,
|
||||||
metadata=tool_result.metadata,
|
metadata=tool_result.metadata,
|
||||||
)
|
)
|
||||||
|
@ -744,9 +726,16 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
|
|
||||||
input_messages = input_messages + [message, result_message]
|
input_messages = input_messages + [message, result_message]
|
||||||
|
|
||||||
async def _get_tool_defs(
|
async def _initialize_tools(
|
||||||
self, toolgroups_for_turn: Optional[List[AgentToolGroup]] = None
|
self,
|
||||||
) -> Tuple[List[ToolDefinition], Dict[str, str]]:
|
toolgroups_for_turn: Optional[List[AgentToolGroup]] = None,
|
||||||
|
) -> None:
|
||||||
|
toolgroup_to_args = {}
|
||||||
|
for toolgroup in (self.agent_config.toolgroups or []) + (toolgroups_for_turn or []):
|
||||||
|
if isinstance(toolgroup, AgentToolGroupWithArgs):
|
||||||
|
tool_group_name, _ = self._parse_toolgroup_name(toolgroup.name)
|
||||||
|
toolgroup_to_args[tool_group_name] = toolgroup.args
|
||||||
|
|
||||||
# Determine which tools to include
|
# Determine which tools to include
|
||||||
tool_groups_to_include = toolgroups_for_turn or self.agent_config.toolgroups or []
|
tool_groups_to_include = toolgroups_for_turn or self.agent_config.toolgroups or []
|
||||||
agent_config_toolgroups = []
|
agent_config_toolgroups = []
|
||||||
|
@ -755,8 +744,10 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
if name not in agent_config_toolgroups:
|
if name not in agent_config_toolgroups:
|
||||||
agent_config_toolgroups.append(name)
|
agent_config_toolgroups.append(name)
|
||||||
|
|
||||||
|
toolgroup_to_args = toolgroup_to_args or {}
|
||||||
|
|
||||||
tool_name_to_def = {}
|
tool_name_to_def = {}
|
||||||
tool_to_group = {}
|
tool_name_to_args = {}
|
||||||
|
|
||||||
for tool_def in self.agent_config.client_tools:
|
for tool_def in self.agent_config.client_tools:
|
||||||
if tool_name_to_def.get(tool_def.name, None):
|
if tool_name_to_def.get(tool_def.name, None):
|
||||||
|
@ -774,53 +765,38 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
for param in tool_def.parameters
|
for param in tool_def.parameters
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
tool_to_group[tool_def.name] = "__client_tools__"
|
|
||||||
for toolgroup_name_with_maybe_tool_name in agent_config_toolgroups:
|
for toolgroup_name_with_maybe_tool_name in agent_config_toolgroups:
|
||||||
toolgroup_name, tool_name = self._parse_toolgroup_name(toolgroup_name_with_maybe_tool_name)
|
toolgroup_name, input_tool_name = self._parse_toolgroup_name(toolgroup_name_with_maybe_tool_name)
|
||||||
tools = await self.tool_groups_api.list_tools(toolgroup_id=toolgroup_name)
|
tools = await self.tool_groups_api.list_tools(toolgroup_id=toolgroup_name)
|
||||||
if not tools.data:
|
if not tools.data:
|
||||||
available_tool_groups = ", ".join(
|
available_tool_groups = ", ".join(
|
||||||
[t.identifier for t in (await self.tool_groups_api.list_tool_groups()).data]
|
[t.identifier for t in (await self.tool_groups_api.list_tool_groups()).data]
|
||||||
)
|
)
|
||||||
raise ValueError(f"Toolgroup {toolgroup_name} not found, available toolgroups: {available_tool_groups}")
|
raise ValueError(f"Toolgroup {toolgroup_name} not found, available toolgroups: {available_tool_groups}")
|
||||||
if tool_name is not None and not any(tool.identifier == tool_name for tool in tools.data):
|
if input_tool_name is not None and not any(tool.identifier == input_tool_name for tool in tools.data):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Tool {tool_name} not found in toolgroup {toolgroup_name}. Available tools: {', '.join([tool.identifier for tool in tools.data])}"
|
f"Tool {input_tool_name} not found in toolgroup {toolgroup_name}. Available tools: {', '.join([tool.identifier for tool in tools.data])}"
|
||||||
)
|
)
|
||||||
|
|
||||||
for tool_def in tools.data:
|
for tool_def in tools.data:
|
||||||
if toolgroup_name.startswith("builtin") and toolgroup_name != RAG_TOOL_GROUP:
|
if toolgroup_name.startswith("builtin") and toolgroup_name != RAG_TOOL_GROUP:
|
||||||
tool_name = tool_def.identifier
|
identifier: str | BuiltinTool | None = tool_def.identifier
|
||||||
built_in_type = BuiltinTool.brave_search
|
if identifier == "web_search":
|
||||||
if tool_name == "web_search":
|
identifier = BuiltinTool.brave_search
|
||||||
built_in_type = BuiltinTool.brave_search
|
|
||||||
else:
|
else:
|
||||||
built_in_type = BuiltinTool(tool_name)
|
identifier = BuiltinTool(identifier)
|
||||||
|
else:
|
||||||
|
# add if tool_name is unspecified or the tool_def identifier is the same as the tool_name
|
||||||
|
if input_tool_name in (None, tool_def.identifier):
|
||||||
|
identifier = tool_def.identifier
|
||||||
|
else:
|
||||||
|
identifier = None
|
||||||
|
|
||||||
if tool_name_to_def.get(built_in_type, None):
|
if tool_name_to_def.get(identifier, None):
|
||||||
raise ValueError(f"Tool {built_in_type} already exists")
|
raise ValueError(f"Tool {identifier} already exists")
|
||||||
|
if identifier:
|
||||||
tool_name_to_def[built_in_type] = ToolDefinition(
|
|
||||||
tool_name=built_in_type,
|
|
||||||
description=tool_def.description,
|
|
||||||
parameters={
|
|
||||||
param.name: ToolParamDefinition(
|
|
||||||
param_type=param.parameter_type,
|
|
||||||
description=param.description,
|
|
||||||
required=param.required,
|
|
||||||
default=param.default,
|
|
||||||
)
|
|
||||||
for param in tool_def.parameters
|
|
||||||
},
|
|
||||||
)
|
|
||||||
tool_to_group[built_in_type] = tool_def.toolgroup_id
|
|
||||||
continue
|
|
||||||
|
|
||||||
if tool_name_to_def.get(tool_def.identifier, None):
|
|
||||||
raise ValueError(f"Tool {tool_def.identifier} already exists")
|
|
||||||
if tool_name in (None, tool_def.identifier):
|
|
||||||
tool_name_to_def[tool_def.identifier] = ToolDefinition(
|
tool_name_to_def[tool_def.identifier] = ToolDefinition(
|
||||||
tool_name=tool_def.identifier,
|
tool_name=identifier,
|
||||||
description=tool_def.description,
|
description=tool_def.description,
|
||||||
parameters={
|
parameters={
|
||||||
param.name: ToolParamDefinition(
|
param.name: ToolParamDefinition(
|
||||||
|
@ -832,9 +808,9 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
for param in tool_def.parameters
|
for param in tool_def.parameters
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
tool_to_group[tool_def.identifier] = tool_def.toolgroup_id
|
tool_name_to_args[tool_def.identifier] = toolgroup_to_args.get(toolgroup_name, {})
|
||||||
|
|
||||||
return list(tool_name_to_def.values()), tool_to_group
|
self.tool_defs, self.tool_name_to_args = list(tool_name_to_def.values()), tool_name_to_args
|
||||||
|
|
||||||
def _parse_toolgroup_name(self, toolgroup_name_with_maybe_tool_name: str) -> tuple[str, Optional[str]]:
|
def _parse_toolgroup_name(self, toolgroup_name_with_maybe_tool_name: str) -> tuple[str, Optional[str]]:
|
||||||
"""Parse a toolgroup name into its components.
|
"""Parse a toolgroup name into its components.
|
||||||
|
@ -853,15 +829,46 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
tool_group, tool_name = split_names[0], None
|
tool_group, tool_name = split_names[0], None
|
||||||
return tool_group, tool_name
|
return tool_group, tool_name
|
||||||
|
|
||||||
|
async def execute_tool_call_maybe(
|
||||||
|
self,
|
||||||
|
session_id: str,
|
||||||
|
tool_call: ToolCall,
|
||||||
|
) -> ToolInvocationResult:
|
||||||
|
tool_name = tool_call.tool_name
|
||||||
|
registered_tool_names = [tool_def.tool_name for tool_def in self.tool_defs]
|
||||||
|
if tool_name not in registered_tool_names:
|
||||||
|
raise ValueError(
|
||||||
|
f"Tool {tool_name} not found in provided tools, registered tools: {', '.join([str(x) for x in registered_tool_names])}"
|
||||||
|
)
|
||||||
|
if isinstance(tool_name, BuiltinTool):
|
||||||
|
if tool_name == BuiltinTool.brave_search:
|
||||||
|
tool_name_str = WEB_SEARCH_TOOL
|
||||||
|
else:
|
||||||
|
tool_name_str = tool_name.value
|
||||||
|
else:
|
||||||
|
tool_name_str = tool_name
|
||||||
|
|
||||||
|
logger.info(f"executing tool call: {tool_name_str} with args: {tool_call.arguments}")
|
||||||
|
result = await self.tool_runtime_api.invoke_tool(
|
||||||
|
tool_name=tool_name_str,
|
||||||
|
kwargs={
|
||||||
|
"session_id": session_id,
|
||||||
|
# get the arguments generated by the model and augment with toolgroup arg overrides for the agent
|
||||||
|
**tool_call.arguments,
|
||||||
|
**self.tool_name_to_args.get(tool_name_str, {}),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
logger.debug(f"tool call {tool_name_str} completed with result: {result}")
|
||||||
|
return result
|
||||||
|
|
||||||
async def handle_documents(
|
async def handle_documents(
|
||||||
self,
|
self,
|
||||||
session_id: str,
|
session_id: str,
|
||||||
documents: List[Document],
|
documents: List[Document],
|
||||||
input_messages: List[Message],
|
input_messages: List[Message],
|
||||||
tool_defs: Dict[str, ToolDefinition],
|
|
||||||
) -> None:
|
) -> None:
|
||||||
memory_tool = any(tool_def.tool_name == MEMORY_QUERY_TOOL for tool_def in tool_defs)
|
memory_tool = any(tool_def.tool_name == MEMORY_QUERY_TOOL for tool_def in self.tool_defs)
|
||||||
code_interpreter_tool = any(tool_def.tool_name == BuiltinTool.code_interpreter for tool_def in tool_defs)
|
code_interpreter_tool = any(tool_def.tool_name == BuiltinTool.code_interpreter for tool_def in self.tool_defs)
|
||||||
content_items = []
|
content_items = []
|
||||||
url_items = []
|
url_items = []
|
||||||
pattern = re.compile("^(https?://|file://|data:)")
|
pattern = re.compile("^(https?://|file://|data:)")
|
||||||
|
@ -989,42 +996,10 @@ async def attachment_message(tempdir: str, urls: List[URL]) -> ToolResponseMessa
|
||||||
|
|
||||||
return ToolResponseMessage(
|
return ToolResponseMessage(
|
||||||
call_id="",
|
call_id="",
|
||||||
tool_name=BuiltinTool.code_interpreter,
|
|
||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def execute_tool_call_maybe(
|
|
||||||
tool_runtime_api: ToolRuntime,
|
|
||||||
session_id: str,
|
|
||||||
tool_call: ToolCall,
|
|
||||||
toolgroup_args: Dict[str, Dict[str, Any]],
|
|
||||||
tool_to_group: Dict[str, str],
|
|
||||||
) -> ToolInvocationResult:
|
|
||||||
name = tool_call.tool_name
|
|
||||||
group_name = tool_to_group.get(name, None)
|
|
||||||
if group_name is None:
|
|
||||||
raise ValueError(f"Tool {name} not found in any tool group")
|
|
||||||
if isinstance(name, BuiltinTool):
|
|
||||||
if name == BuiltinTool.brave_search:
|
|
||||||
name = WEB_SEARCH_TOOL
|
|
||||||
else:
|
|
||||||
name = name.value
|
|
||||||
|
|
||||||
logger.info(f"executing tool call: {name} with args: {tool_call.arguments}")
|
|
||||||
result = await tool_runtime_api.invoke_tool(
|
|
||||||
tool_name=name,
|
|
||||||
kwargs={
|
|
||||||
"session_id": session_id,
|
|
||||||
# get the arguments generated by the model and augment with toolgroup arg overrides for the agent
|
|
||||||
**tool_call.arguments,
|
|
||||||
**toolgroup_args.get(group_name, {}),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
logger.info(f"tool call {name} completed with result: {result}")
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def _interpret_content_as_attachment(
|
def _interpret_content_as_attachment(
|
||||||
content: str,
|
content: str,
|
||||||
) -> Optional[Attachment]:
|
) -> Optional[Attachment]:
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
#
|
#
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.distribution.utils.config_dirs import RUNTIME_BASE_DIR
|
|
||||||
from llama_stack.providers.utils.kvstore.config import (
|
from llama_stack.providers.utils.kvstore.config import (
|
||||||
KVStoreConfig,
|
KVStoreConfig,
|
||||||
SqliteKVStoreConfig,
|
SqliteKVStoreConfig,
|
||||||
|
@ -13,6 +14,13 @@ from llama_stack.providers.utils.kvstore.config import (
|
||||||
|
|
||||||
|
|
||||||
class LocalFSDatasetIOConfig(BaseModel):
|
class LocalFSDatasetIOConfig(BaseModel):
|
||||||
kvstore: KVStoreConfig = SqliteKVStoreConfig(
|
kvstore: KVStoreConfig
|
||||||
db_path=(RUNTIME_BASE_DIR / "localfs_datasetio.db").as_posix()
|
|
||||||
) # Uses SQLite config specific to localfs storage
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"kvstore": SqliteKVStoreConfig.sample_run_config(
|
||||||
|
__distro_dir__=__distro_dir__,
|
||||||
|
db_name="localfs_datasetio.db",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
#
|
#
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.distribution.utils.config_dirs import RUNTIME_BASE_DIR
|
|
||||||
from llama_stack.providers.utils.kvstore.config import (
|
from llama_stack.providers.utils.kvstore.config import (
|
||||||
KVStoreConfig,
|
KVStoreConfig,
|
||||||
SqliteKVStoreConfig,
|
SqliteKVStoreConfig,
|
||||||
|
@ -13,6 +14,13 @@ from llama_stack.providers.utils.kvstore.config import (
|
||||||
|
|
||||||
|
|
||||||
class MetaReferenceEvalConfig(BaseModel):
|
class MetaReferenceEvalConfig(BaseModel):
|
||||||
kvstore: KVStoreConfig = SqliteKVStoreConfig(
|
kvstore: KVStoreConfig
|
||||||
db_path=(RUNTIME_BASE_DIR / "meta_reference_eval.db").as_posix()
|
|
||||||
) # Uses SQLite config specific to Meta Reference Eval storage
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"kvstore": SqliteKVStoreConfig.sample_run_config(
|
||||||
|
__distro_dir__=__distro_dir__,
|
||||||
|
db_name="meta_reference_eval.db",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
from llama_stack.schema_utils import json_schema_type
|
||||||
|
@ -40,7 +42,7 @@ class VLLMConfig(BaseModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def sample_run_config(cls):
|
def sample_run_config(cls, **kwargs: Any) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"tensor_parallel_size": "${env.TENSOR_PARALLEL_SIZE:1}",
|
"tensor_parallel_size": "${env.TENSOR_PARALLEL_SIZE:1}",
|
||||||
"max_tokens": "${env.MAX_TOKENS:4096}",
|
"max_tokens": "${env.MAX_TOKENS:4096}",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import Literal, Optional
|
from typing import Any, Dict, Literal, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@ -12,3 +12,9 @@ from pydantic import BaseModel
|
||||||
class TorchtunePostTrainingConfig(BaseModel):
|
class TorchtunePostTrainingConfig(BaseModel):
|
||||||
torch_seed: Optional[int] = None
|
torch_seed: Optional[int] = None
|
||||||
checkpoint_format: Optional[Literal["meta", "huggingface"]] = "meta"
|
checkpoint_format: Optional[Literal["meta", "huggingface"]] = "meta"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"checkpoint_format": "meta",
|
||||||
|
}
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class CodeScannerConfig(BaseModel):
|
class CodeScannerConfig(BaseModel):
|
||||||
pass
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -4,10 +4,16 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class LlamaGuardConfig(BaseModel):
|
class LlamaGuardConfig(BaseModel):
|
||||||
excluded_categories: List[str] = []
|
excluded_categories: List[str] = []
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"excluded_categories": [],
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel, field_validator
|
from pydantic import BaseModel, field_validator
|
||||||
|
|
||||||
|
@ -23,3 +24,9 @@ class PromptGuardConfig(BaseModel):
|
||||||
if v not in [t.value for t in PromptGuardType]:
|
if v not in [t.value for t in PromptGuardType]:
|
||||||
raise ValueError(f"Unknown prompt guard type: {v}")
|
raise ValueError(f"Unknown prompt guard type: {v}")
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"guard_type": "injection",
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
#
|
#
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class BasicScoringConfig(BaseModel): ...
|
class BasicScoringConfig(BaseModel):
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
#
|
#
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class LlmAsJudgeScoringConfig(BaseModel): ...
|
class LlmAsJudgeScoringConfig(BaseModel):
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SampleConfig, _deps) -> Any:
|
|
||||||
from .sample import SampleTelemetryImpl
|
|
||||||
|
|
||||||
impl = SampleTelemetryImpl(config)
|
|
||||||
await impl.initialize()
|
|
||||||
return impl
|
|
|
@ -1,12 +0,0 @@
|
||||||
# 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 pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class SampleConfig(BaseModel):
|
|
||||||
host: str = "localhost"
|
|
||||||
port: int = 9999
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 llama_stack.apis.telemetry import Telemetry
|
|
||||||
|
|
||||||
from .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
class SampleTelemetryImpl(Telemetry):
|
|
||||||
def __init__(self, config: SampleConfig):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
pass
|
|
|
@ -76,6 +76,7 @@ class CodeExecutionRequest:
|
||||||
only_last_cell_fail: bool = True
|
only_last_cell_fail: bool = True
|
||||||
seed: int = 0
|
seed: int = 0
|
||||||
strip_fpaths_in_stderr: bool = True
|
strip_fpaths_in_stderr: bool = True
|
||||||
|
use_bwrap: bool = True
|
||||||
|
|
||||||
|
|
||||||
class CodeExecutor:
|
class CodeExecutor:
|
||||||
|
@ -103,8 +104,6 @@ _set_seeds()\
|
||||||
|
|
||||||
script = "\n\n".join([seeds_prefix] + [CODE_ENV_PREFIX] + scripts)
|
script = "\n\n".join([seeds_prefix] + [CODE_ENV_PREFIX] + scripts)
|
||||||
with tempfile.TemporaryDirectory() as dpath:
|
with tempfile.TemporaryDirectory() as dpath:
|
||||||
bwrap_prefix = "bwrap " + generate_bwrap_command(bind_dirs=[dpath])
|
|
||||||
cmd = [*bwrap_prefix.split(), sys.executable, "-c", script]
|
|
||||||
code_fpath = os.path.join(dpath, "code.py")
|
code_fpath = os.path.join(dpath, "code.py")
|
||||||
with open(code_fpath, "w") as f:
|
with open(code_fpath, "w") as f:
|
||||||
f.write(script)
|
f.write(script)
|
||||||
|
@ -118,6 +117,13 @@ _set_seeds()\
|
||||||
MPLBACKEND="module://matplotlib_custom_backend",
|
MPLBACKEND="module://matplotlib_custom_backend",
|
||||||
PYTHONPATH=f"{DIRNAME}:{python_path}",
|
PYTHONPATH=f"{DIRNAME}:{python_path}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if req.use_bwrap:
|
||||||
|
bwrap_prefix = "bwrap " + generate_bwrap_command(bind_dirs=[dpath])
|
||||||
|
cmd = [*bwrap_prefix.split(), sys.executable, "-c", script]
|
||||||
|
else:
|
||||||
|
cmd = [sys.executable, "-c", script]
|
||||||
|
|
||||||
stdout, stderr, returncode = do_subprocess(
|
stdout, stderr, returncode = do_subprocess(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
env=env,
|
env=env,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
@ -61,7 +62,9 @@ class CodeInterpreterToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime):
|
||||||
|
|
||||||
async def invoke_tool(self, tool_name: str, kwargs: Dict[str, Any]) -> ToolInvocationResult:
|
async def invoke_tool(self, tool_name: str, kwargs: Dict[str, Any]) -> ToolInvocationResult:
|
||||||
script = kwargs["code"]
|
script = kwargs["code"]
|
||||||
req = CodeExecutionRequest(scripts=[script])
|
# Use environment variable to control bwrap usage
|
||||||
|
force_disable_bwrap = os.environ.get("DISABLE_CODE_SANDBOX", "").lower() in ("1", "true", "yes")
|
||||||
|
req = CodeExecutionRequest(scripts=[script], use_bwrap=not force_disable_bwrap)
|
||||||
res = self.code_executor.execute(req)
|
res = self.code_executor.execute(req)
|
||||||
pieces = [res["process_status"]]
|
pieces = [res["process_status"]]
|
||||||
for out_type in ["stdout", "stderr"]:
|
for out_type in ["stdout", "stderr"]:
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class CodeInterpreterToolConfig(BaseModel):
|
class CodeInterpreterToolConfig(BaseModel):
|
||||||
pass
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class RagToolRuntimeConfig(BaseModel):
|
class RagToolRuntimeConfig(BaseModel):
|
||||||
pass
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -13,5 +13,5 @@ class ChromaVectorIOConfig(BaseModel):
|
||||||
db_path: str
|
db_path: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def sample_config(cls) -> Dict[str, Any]:
|
def sample_run_config(cls, db_path: str = "${env.CHROMADB_PATH}", **kwargs: Any) -> Dict[str, Any]:
|
||||||
return {"db_path": "{env.CHROMADB_PATH}"}
|
return {"db_path": db_path}
|
||||||
|
|
|
@ -7,11 +7,9 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from llama_stack.providers.datatypes import (
|
from llama_stack.providers.datatypes import (
|
||||||
AdapterSpec,
|
|
||||||
Api,
|
Api,
|
||||||
InlineProviderSpec,
|
InlineProviderSpec,
|
||||||
ProviderSpec,
|
ProviderSpec,
|
||||||
remote_provider_spec,
|
|
||||||
)
|
)
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_dependencies
|
from llama_stack.providers.utils.kvstore import kvstore_dependencies
|
||||||
|
|
||||||
|
@ -39,13 +37,4 @@ def available_providers() -> List[ProviderSpec]:
|
||||||
Api.tool_groups,
|
Api.tool_groups,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.agents,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sample",
|
|
||||||
pip_packages=[],
|
|
||||||
module="llama_stack.providers.remote.agents.sample",
|
|
||||||
config_class="llama_stack.providers.remote.agents.sample.SampleConfig",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -68,15 +68,6 @@ def available_providers() -> List[ProviderSpec]:
|
||||||
module="llama_stack.providers.inline.inference.sentence_transformers",
|
module="llama_stack.providers.inline.inference.sentence_transformers",
|
||||||
config_class="llama_stack.providers.inline.inference.sentence_transformers.config.SentenceTransformersInferenceConfig",
|
config_class="llama_stack.providers.inline.inference.sentence_transformers.config.SentenceTransformersInferenceConfig",
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.inference,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sample",
|
|
||||||
pip_packages=[],
|
|
||||||
module="llama_stack.providers.remote.inference.sample",
|
|
||||||
config_class="llama_stack.providers.remote.inference.sample.SampleConfig",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
remote_provider_spec(
|
||||||
api=Api.inference,
|
api=Api.inference,
|
||||||
adapter=AdapterSpec(
|
adapter=AdapterSpec(
|
||||||
|
|
|
@ -27,27 +27,6 @@ def available_providers() -> List[ProviderSpec]:
|
||||||
module="llama_stack.providers.inline.safety.prompt_guard",
|
module="llama_stack.providers.inline.safety.prompt_guard",
|
||||||
config_class="llama_stack.providers.inline.safety.prompt_guard.PromptGuardConfig",
|
config_class="llama_stack.providers.inline.safety.prompt_guard.PromptGuardConfig",
|
||||||
),
|
),
|
||||||
InlineProviderSpec(
|
|
||||||
api=Api.safety,
|
|
||||||
provider_type="inline::meta-reference",
|
|
||||||
pip_packages=[
|
|
||||||
"transformers",
|
|
||||||
"torch --index-url https://download.pytorch.org/whl/cpu",
|
|
||||||
],
|
|
||||||
module="llama_stack.providers.inline.safety.meta_reference",
|
|
||||||
config_class="llama_stack.providers.inline.safety.meta_reference.SafetyConfig",
|
|
||||||
api_dependencies=[
|
|
||||||
Api.inference,
|
|
||||||
],
|
|
||||||
deprecation_error="""
|
|
||||||
Provider `inline::meta-reference` for API `safety` does not work with the latest Llama Stack.
|
|
||||||
|
|
||||||
- if you are using Llama Guard v3, please use the `inline::llama-guard` provider instead.
|
|
||||||
- if you are using Prompt Guard, please use the `inline::prompt-guard` provider instead.
|
|
||||||
- if you are using Code Scanner, please use the `inline::code-scanner` provider instead.
|
|
||||||
|
|
||||||
""",
|
|
||||||
),
|
|
||||||
InlineProviderSpec(
|
InlineProviderSpec(
|
||||||
api=Api.safety,
|
api=Api.safety,
|
||||||
provider_type="inline::llama-guard",
|
provider_type="inline::llama-guard",
|
||||||
|
@ -67,15 +46,6 @@ Provider `inline::meta-reference` for API `safety` does not work with the latest
|
||||||
module="llama_stack.providers.inline.safety.code_scanner",
|
module="llama_stack.providers.inline.safety.code_scanner",
|
||||||
config_class="llama_stack.providers.inline.safety.code_scanner.CodeScannerConfig",
|
config_class="llama_stack.providers.inline.safety.code_scanner.CodeScannerConfig",
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.safety,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sample",
|
|
||||||
pip_packages=[],
|
|
||||||
module="llama_stack.providers.remote.safety.sample",
|
|
||||||
config_class="llama_stack.providers.remote.safety.sample.SampleConfig",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
remote_provider_spec(
|
||||||
api=Api.safety,
|
api=Api.safety,
|
||||||
adapter=AdapterSpec(
|
adapter=AdapterSpec(
|
||||||
|
|
|
@ -7,11 +7,9 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from llama_stack.providers.datatypes import (
|
from llama_stack.providers.datatypes import (
|
||||||
AdapterSpec,
|
|
||||||
Api,
|
Api,
|
||||||
InlineProviderSpec,
|
InlineProviderSpec,
|
||||||
ProviderSpec,
|
ProviderSpec,
|
||||||
remote_provider_spec,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,13 +26,4 @@ def available_providers() -> List[ProviderSpec]:
|
||||||
module="llama_stack.providers.inline.telemetry.meta_reference",
|
module="llama_stack.providers.inline.telemetry.meta_reference",
|
||||||
config_class="llama_stack.providers.inline.telemetry.meta_reference.config.TelemetryConfig",
|
config_class="llama_stack.providers.inline.telemetry.meta_reference.config.TelemetryConfig",
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.telemetry,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sample",
|
|
||||||
pip_packages=[],
|
|
||||||
module="llama_stack.providers.remote.telemetry.sample",
|
|
||||||
config_class="llama_stack.providers.remote.telemetry.sample.SampleConfig",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -92,16 +92,6 @@ def available_providers() -> List[ProviderSpec]:
|
||||||
),
|
),
|
||||||
api_dependencies=[Api.inference],
|
api_dependencies=[Api.inference],
|
||||||
),
|
),
|
||||||
remote_provider_spec(
|
|
||||||
api=Api.vector_io,
|
|
||||||
adapter=AdapterSpec(
|
|
||||||
adapter_type="sample",
|
|
||||||
pip_packages=[],
|
|
||||||
module="llama_stack.providers.remote.vector_io.sample",
|
|
||||||
config_class="llama_stack.providers.remote.vector_io.sample.SampleVectorIOConfig",
|
|
||||||
),
|
|
||||||
api_dependencies=[],
|
|
||||||
),
|
|
||||||
remote_provider_spec(
|
remote_provider_spec(
|
||||||
Api.vector_io,
|
Api.vector_io,
|
||||||
AdapterSpec(
|
AdapterSpec(
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SampleConfig, _deps) -> Any:
|
|
||||||
from .sample import SampleAgentsImpl
|
|
||||||
|
|
||||||
impl = SampleAgentsImpl(config)
|
|
||||||
await impl.initialize()
|
|
||||||
return impl
|
|
|
@ -1,12 +0,0 @@
|
||||||
# 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 pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class SampleConfig(BaseModel):
|
|
||||||
host: str = "localhost"
|
|
||||||
port: int = 9999
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 llama_stack.apis.agents import Agents
|
|
||||||
|
|
||||||
from .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
class SampleAgentsImpl(Agents):
|
|
||||||
def __init__(self, config: SampleConfig):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
pass
|
|
|
@ -3,9 +3,10 @@
|
||||||
#
|
#
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.distribution.utils.config_dirs import RUNTIME_BASE_DIR
|
|
||||||
from llama_stack.providers.utils.kvstore.config import (
|
from llama_stack.providers.utils.kvstore.config import (
|
||||||
KVStoreConfig,
|
KVStoreConfig,
|
||||||
SqliteKVStoreConfig,
|
SqliteKVStoreConfig,
|
||||||
|
@ -13,6 +14,13 @@ from llama_stack.providers.utils.kvstore.config import (
|
||||||
|
|
||||||
|
|
||||||
class HuggingfaceDatasetIOConfig(BaseModel):
|
class HuggingfaceDatasetIOConfig(BaseModel):
|
||||||
kvstore: KVStoreConfig = SqliteKVStoreConfig(
|
kvstore: KVStoreConfig
|
||||||
db_path=(RUNTIME_BASE_DIR / "huggingface_datasetio.db").as_posix()
|
|
||||||
) # Uses SQLite config specific to HF storage
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"kvstore": SqliteKVStoreConfig.sample_run_config(
|
||||||
|
__distro_dir__=__distro_dir__,
|
||||||
|
db_name="huggingface_datasetio.db",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
@ -20,3 +21,15 @@ class DatabricksImplConfig(BaseModel):
|
||||||
default=None,
|
default=None,
|
||||||
description="The Databricks API token",
|
description="The Databricks API token",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(
|
||||||
|
cls,
|
||||||
|
url: str = "${env.DATABRICKS_URL}",
|
||||||
|
api_token: str = "${env.DATABRICKS_API_TOKEN}",
|
||||||
|
**kwargs: Any,
|
||||||
|
) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"url": url,
|
||||||
|
"api_token": api_token,
|
||||||
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from .config import RunpodImplConfig
|
from .config import RunpodImplConfig
|
||||||
from .runpod import RunpodInferenceAdapter
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: RunpodImplConfig, _deps):
|
async def get_adapter_impl(config: RunpodImplConfig, _deps):
|
||||||
|
from .runpod import RunpodInferenceAdapter
|
||||||
|
|
||||||
assert isinstance(config, RunpodImplConfig), f"Unexpected config type: {type(config)}"
|
assert isinstance(config, RunpodImplConfig), f"Unexpected config type: {type(config)}"
|
||||||
impl = RunpodInferenceAdapter(config)
|
impl = RunpodInferenceAdapter(config)
|
||||||
await impl.initialize()
|
await impl.initialize()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
@ -21,3 +21,10 @@ class RunpodImplConfig(BaseModel):
|
||||||
default=None,
|
default=None,
|
||||||
description="The API token",
|
description="The API token",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"url": "${env.RUNPOD_URL:}",
|
||||||
|
"api_token": "${env.RUNPOD_API_TOKEN:}",
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ from typing import AsyncGenerator
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
|
|
||||||
from llama_stack.apis.inference import * # noqa: F403
|
from llama_stack.apis.inference import * # noqa: F403
|
||||||
from llama_stack.models.llama.datatypes import Message
|
|
||||||
|
|
||||||
# from llama_stack.providers.datatypes import ModelsProtocolPrivate
|
# from llama_stack.providers.datatypes import ModelsProtocolPrivate
|
||||||
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SampleConfig, _deps) -> Any:
|
|
||||||
from .sample import SampleInferenceImpl
|
|
||||||
|
|
||||||
impl = SampleInferenceImpl(config)
|
|
||||||
await impl.initialize()
|
|
||||||
return impl
|
|
|
@ -1,12 +0,0 @@
|
||||||
# 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 pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class SampleConfig(BaseModel):
|
|
||||||
host: str = "localhost"
|
|
||||||
port: int = 9999
|
|
|
@ -1,23 +0,0 @@
|
||||||
# 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 llama_stack.apis.inference import Inference
|
|
||||||
from llama_stack.apis.models import Model
|
|
||||||
|
|
||||||
from .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
class SampleInferenceImpl(Inference):
|
|
||||||
def __init__(self, config: SampleConfig):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def register_model(self, model: Model) -> None:
|
|
||||||
# these are the model names the Llama Stack will use to route requests to this provider
|
|
||||||
# perform validation here if necessary
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
pass
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SampleConfig, _deps) -> Any:
|
|
||||||
from .sample import SampleSafetyImpl
|
|
||||||
|
|
||||||
impl = SampleSafetyImpl(config)
|
|
||||||
await impl.initialize()
|
|
||||||
return impl
|
|
|
@ -1,12 +0,0 @@
|
||||||
# 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 pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class SampleConfig(BaseModel):
|
|
||||||
host: str = "localhost"
|
|
||||||
port: int = 9999
|
|
|
@ -1,23 +0,0 @@
|
||||||
# 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 llama_stack.apis.safety import Safety
|
|
||||||
from llama_stack.apis.shields import Shield
|
|
||||||
|
|
||||||
from .config import SampleConfig
|
|
||||||
|
|
||||||
|
|
||||||
class SampleSafetyImpl(Safety):
|
|
||||||
def __init__(self, config: SampleConfig):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def register_shield(self, shield: Shield) -> None:
|
|
||||||
# these are the safety shields the Llama Stack will use to route requests to this provider
|
|
||||||
# perform validation here if necessary
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
pass
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@ -14,3 +14,9 @@ class BingSearchToolConfig(BaseModel):
|
||||||
|
|
||||||
api_key: Optional[str] = None
|
api_key: Optional[str] = None
|
||||||
top_k: int = 3
|
top_k: int = 3
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"api_key": "${env.BING_API_KEY:}",
|
||||||
|
}
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class ModelContextProtocolConfig(BaseModel):
|
class ModelContextProtocolConfig(BaseModel):
|
||||||
pass
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@ -13,3 +13,9 @@ class WolframAlphaToolConfig(BaseModel):
|
||||||
"""Configuration for WolframAlpha Tool Runtime"""
|
"""Configuration for WolframAlpha Tool Runtime"""
|
||||||
|
|
||||||
api_key: Optional[str] = None
|
api_key: Optional[str] = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"api_key": "${env.WOLFRAM_ALPHA_API_KEY:}",
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
@ -24,3 +24,9 @@ class QdrantVectorIOConfig(BaseModel):
|
||||||
timeout: Optional[int] = None
|
timeout: Optional[int] = None
|
||||||
host: Optional[str] = None
|
host: Optional[str] = None
|
||||||
path: Optional[str] = None
|
path: Optional[str] = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample_run_config(cls, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"api_key": "${env.QDRANT_API_KEY}",
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# 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 .config import SampleVectorIOConfig
|
|
||||||
|
|
||||||
|
|
||||||
async def get_adapter_impl(config: SampleVectorIOConfig, _deps) -> Any:
|
|
||||||
from .sample import SampleVectorIOImpl
|
|
||||||
|
|
||||||
impl = SampleVectorIOImpl(config)
|
|
||||||
await impl.initialize()
|
|
||||||
return impl
|
|
|
@ -1,12 +0,0 @@
|
||||||
# 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 pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class SampleVectorIOConfig(BaseModel):
|
|
||||||
host: str = "localhost"
|
|
||||||
port: int = 9999
|
|
|
@ -1,26 +0,0 @@
|
||||||
# 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 llama_stack.apis.vector_dbs import VectorDB
|
|
||||||
from llama_stack.apis.vector_io import VectorIO
|
|
||||||
|
|
||||||
from .config import SampleVectorIOConfig
|
|
||||||
|
|
||||||
|
|
||||||
class SampleVectorIOImpl(VectorIO):
|
|
||||||
def __init__(self, config: SampleVectorIOConfig):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
async def register_vector_db(self, vector_db: VectorDB) -> None:
|
|
||||||
# these are the vector dbs the Llama Stack will use to route requests to this provider
|
|
||||||
# perform validation here if necessary
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def initialize(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def shutdown(self):
|
|
||||||
pass
|
|
|
@ -4,6 +4,8 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,4 +15,6 @@ class WeaviateRequestProviderData(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class WeaviateVectorIOConfig(BaseModel):
|
class WeaviateVectorIOConfig(BaseModel):
|
||||||
pass
|
@classmethod
|
||||||
|
def sample_run_config(cls, **kwargs: Any) -> Dict[str, Any]:
|
||||||
|
return {}
|
||||||
|
|
|
@ -45,14 +45,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/bedrock}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/bedrock}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/bedrock}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -23,7 +23,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
vector_io:
|
vector_io:
|
||||||
- provider_id: faiss
|
- provider_id: faiss
|
||||||
provider_type: inline::faiss
|
provider_type: inline::faiss
|
||||||
|
@ -43,14 +44,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/cerebras}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/cerebras}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/cerebras}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -28,7 +28,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -47,14 +48,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ci-tests}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ci-tests}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ci-tests}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -27,7 +27,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -46,14 +47,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dell}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -57,7 +57,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -76,14 +77,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dev}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dev}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/dev}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -56,14 +56,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -88,7 +100,8 @@ providers:
|
||||||
max_results: 3
|
max_results: 3
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
- provider_id: code-interpreter
|
- provider_id: code-interpreter
|
||||||
provider_type: inline::code-interpreter
|
provider_type: inline::code-interpreter
|
||||||
config: {}
|
config: {}
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/fireworks}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -82,7 +95,8 @@ providers:
|
||||||
max_results: 3
|
max_results: 3
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
- provider_id: code-interpreter
|
- provider_id: code-interpreter
|
||||||
provider_type: inline::code-interpreter
|
provider_type: inline::code-interpreter
|
||||||
config: {}
|
config: {}
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/groq}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/groq}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/groq}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -36,7 +36,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -55,14 +56,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-endpoint}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -36,7 +36,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -55,14 +56,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/hf-serverless}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -38,7 +38,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -57,14 +58,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -32,7 +32,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -51,14 +52,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-gpu}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -34,7 +34,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -53,14 +54,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-quantized-gpu}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-quantized-gpu}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/meta-reference-quantized-gpu}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -28,7 +28,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -47,14 +48,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/nvidia}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/nvidia}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/nvidia}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -49,14 +49,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -90,7 +102,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/registry.db
|
||||||
|
|
|
@ -27,7 +27,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -46,14 +47,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -87,7 +100,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/ollama}/registry.db
|
||||||
|
|
|
@ -54,7 +54,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -73,14 +74,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/open-benchmark}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/open-benchmark}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/open-benchmark}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -38,7 +38,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -98,7 +111,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/registry.db
|
||||||
|
|
|
@ -32,7 +32,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -44,14 +45,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -92,7 +105,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/remote-vllm}/registry.db
|
||||||
|
|
|
@ -37,7 +37,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -30,7 +30,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -49,14 +50,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/tgi}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -56,14 +56,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -97,7 +109,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/registry.db
|
||||||
|
|
|
@ -31,7 +31,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -50,14 +51,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
@ -91,7 +104,8 @@ providers:
|
||||||
config: {}
|
config: {}
|
||||||
- provider_id: wolfram-alpha
|
- provider_id: wolfram-alpha
|
||||||
provider_type: remote::wolfram-alpha
|
provider_type: remote::wolfram-alpha
|
||||||
config: {}
|
config:
|
||||||
|
api_key: ${env.WOLFRAM_ALPHA_API_KEY:}
|
||||||
metadata_store:
|
metadata_store:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/registry.db
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/together}/registry.db
|
||||||
|
|
|
@ -35,7 +35,8 @@ providers:
|
||||||
safety:
|
safety:
|
||||||
- provider_id: llama-guard
|
- provider_id: llama-guard
|
||||||
provider_type: inline::llama-guard
|
provider_type: inline::llama-guard
|
||||||
config: {}
|
config:
|
||||||
|
excluded_categories: []
|
||||||
agents:
|
agents:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
|
@ -54,14 +55,26 @@ providers:
|
||||||
eval:
|
eval:
|
||||||
- provider_id: meta-reference
|
- provider_id: meta-reference
|
||||||
provider_type: inline::meta-reference
|
provider_type: inline::meta-reference
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/vllm-gpu}/meta_reference_eval.db
|
||||||
datasetio:
|
datasetio:
|
||||||
- provider_id: huggingface
|
- provider_id: huggingface
|
||||||
provider_type: remote::huggingface
|
provider_type: remote::huggingface
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/vllm-gpu}/huggingface_datasetio.db
|
||||||
- provider_id: localfs
|
- provider_id: localfs
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
config: {}
|
config:
|
||||||
|
kvstore:
|
||||||
|
type: sqlite
|
||||||
|
namespace: null
|
||||||
|
db_path: ${env.SQLITE_STORE_DIR:~/.llama/distributions/vllm-gpu}/localfs_datasetio.db
|
||||||
scoring:
|
scoring:
|
||||||
- provider_id: basic
|
- provider_id: basic
|
||||||
provider_type: inline::basic
|
provider_type: inline::basic
|
||||||
|
|
|
@ -186,7 +186,7 @@ def test_builtin_tool_web_search(llama_stack_client_with_mocked_inference, agent
|
||||||
messages=[
|
messages=[
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": "Search the web and tell me who the current CEO of Meta is.",
|
"content": "Search the web and tell me who the founder of Meta is.",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
|
|
|
@ -6,12 +6,17 @@
|
||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
|
||||||
from .report import Report
|
from .report import Report
|
||||||
|
|
||||||
|
logger = get_logger(__name__, category="tests")
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.option.tbstyle = "short"
|
config.option.tbstyle = "short"
|
||||||
|
@ -24,6 +29,10 @@ def pytest_configure(config):
|
||||||
key, value = env_var.split("=", 1)
|
key, value = env_var.split("=", 1)
|
||||||
os.environ[key] = value
|
os.environ[key] = value
|
||||||
|
|
||||||
|
if platform.system() == "Darwin": # Darwin is the system name for macOS
|
||||||
|
os.environ["DISABLE_CODE_SANDBOX"] = "1"
|
||||||
|
logger.info("Setting DISABLE_CODE_SANDBOX=1 for macOS")
|
||||||
|
|
||||||
if config.getoption("--report"):
|
if config.getoption("--report"):
|
||||||
config.pluginmanager.register(Report(config))
|
config.pluginmanager.register(Report(config))
|
||||||
|
|
||||||
|
|
|
@ -413,23 +413,23 @@
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Result 1:\nDocument_id:3e31d\nContent: conversational data, :func:`~torchtune.datasets.chat_dataset` seems to be a good fit. For any\ncustom local dataset we always need to specify ``source``, ``data_files``, and ``split`` for any dataset\nbuilder in torchtune. For :func:`~torchtune.datasets.chat_dataset`, we additionally need to specify\n``conversation_column`` and ``conversation_style``. Our data follows the ``\"sharegpt\"`` format, so\nwe can specify that here. Altogether, our :func:`~torchtune.datasets.chat_dataset` call should\nlook like so:\n\n.. code-block:: python\n\n from torchtune.datasets import chat_dataset\n from torchtune.models.llama3 import llama3_tokenizer\n\n tokenizer = llama3_tokenizer(\"/tmp/Meta-Llama-3-8B-Instruct/original/tokenizer.model\")\n ds = chat_dataset(\n tokenizer=tokenizer,\n source=\"json\",\n data_files=\"data/my_data.json\",\n split=\"train\",\n conversation_column=\"dialogue\",\n conversation_style=\"sharegpt\",\n )\n\n.. code-block:: yaml\n\n # In config\n tokenizer:\n _component_: torchtune.models.llama3.llama3_tokenizer\n path: /tmp/Meta-Llama-3-8B-Instruct/original/tokenizer.model\n\n dataset:\n _component_: torchtune.datasets.chat_dataset\n source: json\n data_files: data/my_data.json\n split: train\n conversation_column: dialogue\n conversation_style: sharegpt\n\n.. note::\n You can pass in any keyword argument for `load_dataset <https://huggingface.co/docs/datasets/v2.20.0/en/package_reference/loading_methods#datasets.load_dataset>`_ into all our\n Dataset classes and they will honor them. This is useful for common parameters\n such as specifying the data split with :code:`split` or configuration with\n :code:`name`\n\nIf you needed to add a prompt template, you would simply pass it into the tokenizer.\nSince we're fine-tuning Llama3, the tokenizer will handle all formatting for\nus and prompt templates are optional. Other models such as Mistral's :class:`~torchtune.models.mistral._tokenizer.MistralTokenizer`,\nuse a chat template by default (:class:`~torchtune.models.mistral.MistralChatTemplate`) to format\nall messages according to their `recommendations <https://\n",
|
"text": "Result 1:\nDocument_id:bbddb\nContent: conversational data, :func:`~torchtune.datasets.chat_dataset` seems to be a good fit. For any\ncustom local dataset we always need to specify ``source``, ``data_files``, and ``split`` for any dataset\nbuilder in torchtune. For :func:`~torchtune.datasets.chat_dataset`, we additionally need to specify\n``conversation_column`` and ``conversation_style``. Our data follows the ``\"sharegpt\"`` format, so\nwe can specify that here. Altogether, our :func:`~torchtune.datasets.chat_dataset` call should\nlook like so:\n\n.. code-block:: python\n\n from torchtune.datasets import chat_dataset\n from torchtune.models.llama3 import llama3_tokenizer\n\n tokenizer = llama3_tokenizer(\"/tmp/Meta-Llama-3-8B-Instruct/original/tokenizer.model\")\n ds = chat_dataset(\n tokenizer=tokenizer,\n source=\"json\",\n data_files=\"data/my_data.json\",\n split=\"train\",\n conversation_column=\"dialogue\",\n conversation_style=\"sharegpt\",\n )\n\n.. code-block:: yaml\n\n # In config\n tokenizer:\n _component_: torchtune.models.llama3.llama3_tokenizer\n path: /tmp/Meta-Llama-3-8B-Instruct/original/tokenizer.model\n\n dataset:\n _component_: torchtune.datasets.chat_dataset\n source: json\n data_files: data/my_data.json\n split: train\n conversation_column: dialogue\n conversation_style: sharegpt\n\n.. note::\n You can pass in any keyword argument for `load_dataset <https://huggingface.co/docs/datasets/v2.20.0/en/package_reference/loading_methods#datasets.load_dataset>`_ into all our\n Dataset classes and they will honor them. This is useful for common parameters\n such as specifying the data split with :code:`split` or configuration with\n :code:`name`\n\nIf you needed to add a prompt template, you would simply pass it into the tokenizer.\nSince we're fine-tuning Llama3, the tokenizer will handle all formatting for\nus and prompt templates are optional. Other models such as Mistral's :class:`~torchtune.models.mistral._tokenizer.MistralTokenizer`,\nuse a chat template by default (:class:`~torchtune.models.mistral.MistralChatTemplate`) to format\nall messages according to their `recommendations <https://\n",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Result 2:\nDocument_id:14c27\nContent: .. _lora_finetune_label:\n\n============================\nFine-Tuning Llama2 with LoRA\n============================\n\nThis guide will teach you about `LoRA <https://arxiv.org/abs/2106.09685>`_, a parameter-efficient finetuning technique,\nand show you how you can use torchtune to finetune a Llama2 model with LoRA.\nIf you already know what LoRA is and want to get straight to running\nyour own LoRA finetune in torchtune, you can jump to :ref:`LoRA finetuning recipe in torchtune<lora_recipe_label>`.\n\n.. grid:: 2\n\n .. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn\n\n * What LoRA is and how it saves memory during finetuning\n * An overview of LoRA components in torchtune\n * How to run a LoRA finetune using torchtune\n * How to experiment with different LoRA configurations\n\n .. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites\n\n * Be familiar with :ref:`torchtune<overview_label>`\n * Make sure to :ref:`install torchtune<install_label>`\n * Make sure you have downloaded the :ref:`Llama2-7B model weights<download_llama_label>`\n\nWhat is LoRA?\n-------------\n\n`LoRA <https://arxiv.org/abs/2106.09685>`_ is an adapter-based method for\nparameter-efficient finetuning that adds trainable low-rank decomposition matrices to different layers of a neural network,\nthen freezes the network's remaining parameters. LoRA is most commonly applied to\ntransformer models, in which case it is common to add the low-rank matrices\nto some of the linear projections in each transformer layer's self-attention.\n\n.. note::\n\n If you're unfamiliar, check out these references for the `definition of rank <https://en.wikipedia.org/wiki/Rank_(linear_algebra)>`_\n and discussion of `low-rank approximations <https://en.wikipedia.org/wiki/Low-rank_approximation>`_.\n\nBy finetuning with LoRA (as opposed to finetuning all model parameters),\nyou can expect to see memory savings due to a substantial reduction in the\nnumber of parameters with gradients. When using an optimizer with momentum,\nlike `AdamW <https://py\n",
|
"text": "Result 2:\nDocument_id:15b86\nContent: .. _lora_finetune_label:\n\n============================\nFine-Tuning Llama2 with LoRA\n============================\n\nThis guide will teach you about `LoRA <https://arxiv.org/abs/2106.09685>`_, a parameter-efficient finetuning technique,\nand show you how you can use torchtune to finetune a Llama2 model with LoRA.\nIf you already know what LoRA is and want to get straight to running\nyour own LoRA finetune in torchtune, you can jump to :ref:`LoRA finetuning recipe in torchtune<lora_recipe_label>`.\n\n.. grid:: 2\n\n .. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn\n\n * What LoRA is and how it saves memory during finetuning\n * An overview of LoRA components in torchtune\n * How to run a LoRA finetune using torchtune\n * How to experiment with different LoRA configurations\n\n .. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites\n\n * Be familiar with :ref:`torchtune<overview_label>`\n * Make sure to :ref:`install torchtune<install_label>`\n * Make sure you have downloaded the :ref:`Llama2-7B model weights<download_llama_label>`\n\nWhat is LoRA?\n-------------\n\n`LoRA <https://arxiv.org/abs/2106.09685>`_ is an adapter-based method for\nparameter-efficient finetuning that adds trainable low-rank decomposition matrices to different layers of a neural network,\nthen freezes the network's remaining parameters. LoRA is most commonly applied to\ntransformer models, in which case it is common to add the low-rank matrices\nto some of the linear projections in each transformer layer's self-attention.\n\n.. note::\n\n If you're unfamiliar, check out these references for the `definition of rank <https://en.wikipedia.org/wiki/Rank_(linear_algebra)>`_\n and discussion of `low-rank approximations <https://en.wikipedia.org/wiki/Low-rank_approximation>`_.\n\nBy finetuning with LoRA (as opposed to finetuning all model parameters),\nyou can expect to see memory savings due to a substantial reduction in the\nnumber of parameters with gradients. When using an optimizer with momentum,\nlike `AdamW <https://py\n",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Result 3:\nDocument_id:90a49\nContent: ` module, which we swap\n out for :class:`~torchtune.modules.peft.LoRALinear` when ``use_dora=True``.\n\n.. _glossary_distrib:\n\n\n.. TODO\n\n.. Distributed\n.. -----------\n\n.. .. _glossary_fsdp:\n\n.. Fully Sharded Data Parallel (FSDP)\n.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. All our ``_distributed`` recipes use `FSDP <https://pytorch.org/docs/stable/fsdp.html>`.\n.. .. _glossary_fsdp2:\n\n",
|
"text": "Result 3:\nDocument_id:83901\nContent: ` module, which we swap\n out for :class:`~torchtune.modules.peft.LoRALinear` when ``use_dora=True``.\n\n.. _glossary_distrib:\n\n\n.. TODO\n\n.. Distributed\n.. -----------\n\n.. .. _glossary_fsdp:\n\n.. Fully Sharded Data Parallel (FSDP)\n.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. All our ``_distributed`` recipes use `FSDP <https://pytorch.org/docs/stable/fsdp.html>`.\n.. .. _glossary_fsdp2:\n\n",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Result 4:\nDocument_id:14c27\nContent: 06% of all params are trainable.\n\n.. note::\n If you are directly using the LoRA recipe (as detailed :ref:`here<lora_recipe_label>`), you need only pass the\n relevant checkpoint path. Loading model weights and setting trainable parameters will be taken care\n of in the recipe.\n\n\n.. _lora_recipe_label:\n\nLoRA finetuning recipe in torchtune\n-----------------------------------\n\nFinally, we can put it all together and finetune a model using torchtune's `LoRA recipe <https://github.com/pytorch/torchtune/blob/48626d19d2108f92c749411fbd5f0ff140023a25/recipes/lora_finetune.py>`_.\nMake sure that you have first downloaded the Llama2 weights and tokenizer by following :ref:`these instructions<download_llama_label>`.\nYou can then run the following command to perform a LoRA finetune of Llama2-7B with two GPUs (each having VRAM of at least 16GB):\n\n.. code-block:: bash\n\n tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama2/7B_lora\n\n.. note::\n Make sure to point to the location of your Llama2 weights and tokenizer. This can be done\n either by adding :code:`checkpointer.checkpoint_files=[my_model_checkpoint_path] tokenizer_checkpoint=my_tokenizer_checkpoint_path`\n or by directly modifying the :code:`7B_lora.yaml` file. See our \"\":ref:`config_tutorial_label`\" recipe\n for more details on how you can easily clone and modify torchtune configs.\n\n.. note::\n You can modify the value of :code:`nproc_per_node` depending on (a) the number of GPUs you have available,\n and (b) the memory constraints of your hardware.\n\nThe preceding command will run a LoRA finetune with torchtune's factory settings, but we may want to experiment a bit.\nLet's take a closer look at some of the :code:`lora_finetune_distributed` config.\n\n.. code-block:: yaml\n\n # Model Arguments\n model:\n _component_: lora_llama2_7b\n lora_attn_modules: ['q_proj', 'v_proj']\n lora_rank: 8\n lora_alpha: 16\n ...\n\nWe see that the\n",
|
"text": "Result 4:\nDocument_id:15b86\nContent: 06% of all params are trainable.\n\n.. note::\n If you are directly using the LoRA recipe (as detailed :ref:`here<lora_recipe_label>`), you need only pass the\n relevant checkpoint path. Loading model weights and setting trainable parameters will be taken care\n of in the recipe.\n\n\n.. _lora_recipe_label:\n\nLoRA finetuning recipe in torchtune\n-----------------------------------\n\nFinally, we can put it all together and finetune a model using torchtune's `LoRA recipe <https://github.com/pytorch/torchtune/blob/48626d19d2108f92c749411fbd5f0ff140023a25/recipes/lora_finetune.py>`_.\nMake sure that you have first downloaded the Llama2 weights and tokenizer by following :ref:`these instructions<download_llama_label>`.\nYou can then run the following command to perform a LoRA finetune of Llama2-7B with two GPUs (each having VRAM of at least 16GB):\n\n.. code-block:: bash\n\n tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config llama2/7B_lora\n\n.. note::\n Make sure to point to the location of your Llama2 weights and tokenizer. This can be done\n either by adding :code:`checkpointer.checkpoint_files=[my_model_checkpoint_path] tokenizer_checkpoint=my_tokenizer_checkpoint_path`\n or by directly modifying the :code:`7B_lora.yaml` file. See our \"\":ref:`config_tutorial_label`\" recipe\n for more details on how you can easily clone and modify torchtune configs.\n\n.. note::\n You can modify the value of :code:`nproc_per_node` depending on (a) the number of GPUs you have available,\n and (b) the memory constraints of your hardware.\n\nThe preceding command will run a LoRA finetune with torchtune's factory settings, but we may want to experiment a bit.\nLet's take a closer look at some of the :code:`lora_finetune_distributed` config.\n\n.. code-block:: yaml\n\n # Model Arguments\n model:\n _component_: lora_llama2_7b\n lora_attn_modules: ['q_proj', 'v_proj']\n lora_rank: 8\n lora_alpha: 16\n ...\n\nWe see that the\n",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Result 5:\nDocument_id:90a49\nContent: etune\n:func:`torchtune.models.llama3.llama3_8b` with DoRA, you would use :func:`torchtune.models.llama3.lora_llama3_8b` with ``use_dora=True``:\n\n.. code-block:: bash\n\n tune run lora_finetune_single_device --config llama3/8B_lora_single_device \\\n model.use_dora=True\n\n.. code-block:: yaml\n\n model:\n _component_: torchtune.models.lora_llama3_8b\n use_dora: True\n\nSince DoRA extends LoRA, the parameters for :ref:`customizing LoRA <glossary_lora>` are identical. You can also quantize the base model weights like in :ref:`glossary_qlora` by using ``quantize=True`` to reap\neven more memory savings!\n\n.. code-block:: bash\n\n tune run lora_finetune_single_device --config llama3/8B_lora_single_device \\\n model.apply_lora_to_mlp=True \\\n model.lora_attn_modules=[\"q_proj\",\"k_proj\",\"v_proj\"] \\\n model.lora_rank=16 \\\n model.lora_alpha=32 \\\n model.use_dora=True \\\n model.quantize_base=True\n\n.. code-block:: yaml\n\n model:\n _component_: torchtune.models.lora_llama3_8b\n apply_lora_to_mlp: True\n lora_attn_modules: [\"q_proj\", \"k_proj\", \"v_proj\"]\n lora_rank: 16\n lora_alpha: 32\n use_dora: True\n quantize_base: True\n\n\n.. note::\n\n Under the hood, we've enabled DoRA by adding the :class:`~torchtune.modules.peft.DoRALinear` module, which we swap\n out for :class:`~torchtune.modules.peft.LoRALinear` when ``use_dora=True``.\n\n.. _glossary_distrib:\n\n\n.. TODO\n\n.. Distributed\n.. -----------\n\n.. .. _glossary_fsdp:\n\n.. Fully Sharded Data Parallel (FSDP)\n.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. All our ``_distributed`` recipes use `FSDP <https://pytorch.org/docs/stable/fsdp.html>`.\n.. .. _glossary_fsdp2:\n\n",
|
"text": "Result 5:\nDocument_id:83901\nContent: etune\n:func:`torchtune.models.llama3.llama3_8b` with DoRA, you would use :func:`torchtune.models.llama3.lora_llama3_8b` with ``use_dora=True``:\n\n.. code-block:: bash\n\n tune run lora_finetune_single_device --config llama3/8B_lora_single_device \\\n model.use_dora=True\n\n.. code-block:: yaml\n\n model:\n _component_: torchtune.models.lora_llama3_8b\n use_dora: True\n\nSince DoRA extends LoRA, the parameters for :ref:`customizing LoRA <glossary_lora>` are identical. You can also quantize the base model weights like in :ref:`glossary_qlora` by using ``quantize=True`` to reap\neven more memory savings!\n\n.. code-block:: bash\n\n tune run lora_finetune_single_device --config llama3/8B_lora_single_device \\\n model.apply_lora_to_mlp=True \\\n model.lora_attn_modules=[\"q_proj\",\"k_proj\",\"v_proj\"] \\\n model.lora_rank=16 \\\n model.lora_alpha=32 \\\n model.use_dora=True \\\n model.quantize_base=True\n\n.. code-block:: yaml\n\n model:\n _component_: torchtune.models.lora_llama3_8b\n apply_lora_to_mlp: True\n lora_attn_modules: [\"q_proj\", \"k_proj\", \"v_proj\"]\n lora_rank: 16\n lora_alpha: 32\n use_dora: True\n quantize_base: True\n\n\n.. note::\n\n Under the hood, we've enabled DoRA by adding the :class:`~torchtune.modules.peft.DoRALinear` module, which we swap\n out for :class:`~torchtune.modules.peft.LoRALinear` when ``use_dora=True``.\n\n.. _glossary_distrib:\n\n\n.. TODO\n\n.. Distributed\n.. -----------\n\n.. .. _glossary_fsdp:\n\n.. Fully Sharded Data Parallel (FSDP)\n.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. All our ``_distributed`` recipes use `FSDP <https://pytorch.org/docs/stable/fsdp.html>`.\n.. .. _glossary_fsdp2:\n\n",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -441,11 +441,11 @@
|
||||||
"error_message": null,
|
"error_message": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"document_ids": [
|
"document_ids": [
|
||||||
"3e31d46a-5568-49d4-978e-0ab3b6598a7f",
|
"bbddbe62-508d-4c8d-9455-3b60bc2825a5",
|
||||||
"14c2766f-d176-468d-9124-f4a46c5166cf",
|
"15b8638f-b1b6-4f58-adfa-eb6644c47de3",
|
||||||
"90a49271-c246-4bdc-9db9-e3bfa9be5ff1",
|
"83901b53-33d4-4f5e-8145-b94c783e9f61",
|
||||||
"14c2766f-d176-468d-9124-f4a46c5166cf",
|
"15b8638f-b1b6-4f58-adfa-eb6644c47de3",
|
||||||
"90a49271-c246-4bdc-9db9-e3bfa9be5ff1"
|
"83901b53-33d4-4f5e-8145-b94c783e9f61"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
50
tests/unit/providers/test_configs.py
Normal file
50
tests/unit/providers/test_configs.py
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.distribution.distribution import get_provider_registry, providable_apis
|
||||||
|
from llama_stack.distribution.utils.dynamic import instantiate_class_type
|
||||||
|
|
||||||
|
|
||||||
|
class TestProviderConfigurations:
|
||||||
|
"""Test suite for testing provider configurations across all API types."""
|
||||||
|
|
||||||
|
def test_all_api_providers_exist(self):
|
||||||
|
provider_registry = get_provider_registry()
|
||||||
|
for api in providable_apis():
|
||||||
|
providers = provider_registry.get(api, {})
|
||||||
|
assert providers, f"No providers found for API type: {api}"
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("api", providable_apis())
|
||||||
|
def test_api_providers(self, api):
|
||||||
|
provider_registry = get_provider_registry()
|
||||||
|
providers = provider_registry.get(api, {})
|
||||||
|
assert providers, f"No providers found for API type: {api}"
|
||||||
|
|
||||||
|
failures = []
|
||||||
|
for provider_type, provider_spec in providers.items():
|
||||||
|
try:
|
||||||
|
self._verify_provider_config(provider_type, provider_spec)
|
||||||
|
except Exception as e:
|
||||||
|
failures.append(f"Failed to verify {provider_type} config: {str(e)}")
|
||||||
|
|
||||||
|
if failures:
|
||||||
|
pytest.fail("\n".join(failures))
|
||||||
|
|
||||||
|
def _verify_provider_config(self, provider_type, provider_spec):
|
||||||
|
"""Helper method to verify a single provider configuration."""
|
||||||
|
# Get the config class
|
||||||
|
config_class_name = provider_spec.config_class
|
||||||
|
config_type = instantiate_class_type(config_class_name)
|
||||||
|
|
||||||
|
assert issubclass(config_type, BaseModel), f"{config_class_name} is not a subclass of BaseModel"
|
||||||
|
|
||||||
|
assert hasattr(config_type, "sample_run_config"), f"{config_class_name} does not have sample_run_config method"
|
||||||
|
|
||||||
|
sample_config = config_type.sample_run_config(__distro_dir__="foobarbaz")
|
||||||
|
assert isinstance(sample_config, dict), f"{config_class_name}.sample_run_config() did not return a dict"
|
Loading…
Add table
Add a link
Reference in a new issue