mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-28 10:01:59 +00:00
chore: Address review feedback with minor code cleanups
The bulk of the change here is making the naming and contents of the conversion to/from Responses API inputs -> Chat Completion API messages and Chat Completion API choices -> Responses API outputs more clear with some code comments, method renaming, and slight refactoring. There are also some other minor changes, like moving a pydantic model from the api/ to the implementation since it's not actually exposed via the API, as well as making some if/else usage more clear. Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
parent
9166baa716
commit
65c56d0ee8
4 changed files with 93 additions and 84 deletions
|
|
@ -12,19 +12,11 @@ from llama_stack.apis.inference.inference import (
|
|||
OpenAIChatCompletion,
|
||||
)
|
||||
|
||||
FIXTURES_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def load_chat_completion_fixture(filename: str) -> OpenAIChatCompletion:
|
||||
"""
|
||||
Load a YAML fixture file and convert it to an OpenAIChatCompletion object.
|
||||
|
||||
Args:
|
||||
filename: Name of the YAML file (without path)
|
||||
|
||||
Returns:
|
||||
OpenAIChatCompletion object
|
||||
"""
|
||||
fixtures_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
fixture_path = os.path.join(fixtures_dir, filename)
|
||||
fixture_path = os.path.join(FIXTURES_DIR, filename)
|
||||
|
||||
with open(fixture_path) as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ from llama_stack.apis.agents.openai_responses import (
|
|||
OpenAIResponseObject,
|
||||
OpenAIResponseOutputMessageContentOutputText,
|
||||
OpenAIResponseOutputMessageWebSearchToolCall,
|
||||
OpenAIResponsePreviousResponseWithInputItems,
|
||||
)
|
||||
from llama_stack.apis.inference.inference import (
|
||||
OpenAIAssistantMessageParam,
|
||||
|
|
@ -26,6 +25,7 @@ from llama_stack.apis.inference.inference import (
|
|||
)
|
||||
from llama_stack.apis.tools.tools import Tool, ToolGroups, ToolInvocationResult, ToolParameter, ToolRuntime
|
||||
from llama_stack.providers.inline.agents.meta_reference.openai_responses import (
|
||||
OpenAIResponsePreviousResponseWithInputItems,
|
||||
OpenAIResponsesImpl,
|
||||
)
|
||||
from llama_stack.providers.utils.kvstore import KVStore
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue