Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference register fix #114

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/agents/inflation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
from llama_stack_client.types import Attachment, SamplingParams, UserMessage
from llama_stack_client.types.agent_create_params import * # noqa: F403
from common.client_utils import * # noqa: F403
from examples.agents.multi_turn import execute_turns, prompt_to_turn
from termcolor import cprint

from .multi_turn import execute_turns, prompt_to_turn


async def run_main(host: str, port: int, disable_safety: bool = False):
api_keys = load_api_keys_from_env()
Expand Down
56 changes: 0 additions & 56 deletions examples/agents/multi_turn.py

This file was deleted.

15 changes: 13 additions & 2 deletions examples/inference/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@ async def run_main(host: str, port: int, stream: bool = True):
base_url=f"http://{host}:{port}",
)

message = UserMessage(
content="hello world, write me a 2 sentence poem about the moon", role="user"
client.models.register(
model={
"identifier": "Llama3.1-8B-Instruct",
"llama_model": "Llama3.1-8B-Instruct",
"provider_id": "meta-reference-0",
"metadata": {},
}
)

message = {
"role": "user",
"content": "hello world, write me a 2 sentence poem about the moon",
}

cprint(f"User>{message.content}", "green")
response = client.inference.chat_completion(
messages=[message],
Expand Down
19 changes: 13 additions & 6 deletions examples/inference/client_with_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ async def run_main(host: str, port: int, stream: bool = True):

data_url = f"data:{mime_type};base64,{encoded_string}"

message = UserMessage(
role="user",
content=[
{"image": {"uri": data_url}},
"Describe what is in this image.",
],
client.models.register(
model={
"identifier": "Llama3.2-11B-Vision-Instruct",
"llama_model": "Llama3.2-11B-Vision-Instruct",
"provider_id": "meta-reference-0",
"metadata": {},
}
)

message = {
"role": "user",
"content": [{"image": {"uri": data_url}}, "Describe what is in this image."],
}

cprint(f"User>{message.content}", "green")
response = client.inference.chat_completion(
messages=[message],
Expand Down