llama-stack
llama-stack copied to clipboard
Fireworks agent client
What does this PR do?
Support HTTPS for agents api client
Closes # (issue)
Feature/Issue validation/testing/test plan
python -m llama_stack.apis.agents.client https://llamastack-preview.fireworks.ai 443 tools_llama_3_1
/home/bchen/.local/lib/python3.10/site-packages/pydantic/_internal/_fields.py:172: UserWarning: Field name "schema" in "JsonResponseFormat" shadows an attribute in parent "BaseModel"
warnings.warn(
User> Who are you?
StepType.inference> {"type": "function", "name": "brave_search", "parameters": {"query": "who is the assistant"}}
StepType.tool_execution> Tool:BuiltinTool.brave_search Args:{'query': 'who is the assistant'}
StepType.tool_execution> Tool:BuiltinTool.brave_search Response:{"query": "who is the assistant", "top_k": [{"title": "The Assistant movie review & film summary (2020) | Roger Ebert", "url": "https://www.rogerebert.com/reviews/the-assistant-movie-review-2020", "description": "<strong>Julia Garner</strong> plays Jane, an assistant at a movie production company (obviously modeled on Miramax), located in a couple of buildings in lower Manhattan. Jane has only been on the job for 5 weeks, and is fully acclimated (or indoctrinated) to the semi-terrifying office culture.", "type": "search_result"}, {"title": "The Assistant | Rotten Tomatoes", "url": "https://www.rottentomatoes.com/m/the_assistant_2020", "description": "<strong>The</strong> <strong>Assistant</strong> <strong>is</strong> an absolute must-watch... ... Great story and acting! ... BORING BEYOND BELIEF!!! I was disappointed as I like Julia and was anxious to see her in a movie!! I was waiting to see something happen! ... It was awful. We just kept waiting on something, anything to make it interesting. The whole ...", "type": "search_result"}, {"title": "The Assistant is a movie about more than Harvey Weinstein. It\u2019s about the system around him.", "url": "https://www.vox.com/2020/1/29/21112386/the-assistant-interview-weinstein-julia-garner-kitty-green", "description": "She also witnesses, to her slowly ... woman who shows up unexpectedly, saying she\u2019s been promised a job in the office. Harvey Weinstein\u2019s trial matters. Here are 4 resources to help make sense of it. The genius of <strong>The</strong> <strong>Assistant</strong> (clearly modeled on Chantal Akerman\u2019s 1975 feminist masterpiece Jeanne Dielman, 23 Commerce Quay, 1080 Brussels) is that we don\u2019t ...", "type": "search_result"}]}
StepType.shield_call> No Violation
StepType.inference> I am an assistant, a helpful AI assistant. I am here to assist you with any questions or tasks you may have. I can provide information, answer questions, and help with a variety of tasks, such as searching the web, calculating math problems, and more.
User> what is the 100th prime number?
StepType.inference> wolfram_alpha.call(query="100th prime number")
StepType.tool_execution> Tool:BuiltinTool.wolfram_alpha Args:{'query': '100th prime number'}
StepType.tool_execution> Tool:BuiltinTool.wolfram_alpha Response:{"queryresult": {"success": false, "parseidserver": "19", "inputstring": "100th prime number"}}
StepType.shield_call> No Violation
StepType.inference> wolfram_alpha.call(query="100th prime")
StepType.tool_execution> Tool:BuiltinTool.wolfram_alpha Args:{'query': '100th prime'}
StepType.tool_execution> Tool:BuiltinTool.wolfram_alpha Response:{"queryresult": {"success": false, "parseidserver": "15", "inputstring": "100th prime"}}
StepType.shield_call> No Violation
StepType.inference> The 100th prime number is 541.
User> Search web for who was 44th President of USA?
StepType.inference> brave_search.call(query="44th President of USA")
StepType.tool_execution> Tool:BuiltinTool.brave_search Args:{'query': '44th President of USA'}
StepType.tool_execution> Tool:BuiltinTool.brave_search Response:{"query": "44th President of USA", "top_k": [{"title": "Barack Obama | The White House", "url": "https://www.whitehouse.gov/about-the-white-house/presidents/barack-obama/", "description": "<strong>Barack Obama</strong> served as the 44th President of the United States. His story is the American story \u2014 values from the heartland, a middle-class upbringing in a strong family, hard work and education as the means of getting ahead, and the conviction that a life so blessed should be lived in service ...", "type": "search_result"}, {"title": "Barack Obama - Wikipedia", "url": "https://en.wikipedia.org/wiki/Barack_Obama", "description": "Obama addressed supporters and ... and months, I am looking forward to reaching out and working with leaders of both parties." The inauguration of <strong>Barack Obama</strong> as the 44th president took place on January 20, 2009....", "type": "search_result"}, [{"type": "video_result", "url": "https://www.youtube.com/watch?v=iyL7_2-em5k", "title": "- YouTube", "description": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube."}, {"type": "video_result", "url": "https://www.britannica.com/video/172743/overview-Barack-Obama", "title": "President of the United States of America Barack Obama | Britannica", "description": "Witness Barack Obama taking the presidential oath and delivering his inaugural address, January 20, 2009 \u00b7 Listen Joe Biden introducing Barack Obama before the signing into law the repeal of \u201cDon't Ask, Don't Tell,\u201d December 22, 2010 \u00b7 See how the Supreme Court decision in Lochner v. New York affected labourers in the Industrial Revolution ... Barack Obama was elected the 44th ..."}, {"type": "video_result", "url": "https://www.youtube.com/watch?v=JfMG06nOJ_4", "title": "Barack Obama, 44th President of the United States | Biography - ...", "description": "Explore Barack Obama's early life, his years at Harvard, and his courtship with Michelle Obama. See his political path as the first African-American presiden..."}]]}
StepType.shield_call> No Violation
StepType.inference> The 44th President of the USA was Barack Obama.
User> Write code to check if a number is prime. Use that to check if 7 is prime
StepType.inference> def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
print(is_prime(7)) # Output: True
StepType.tool_execution> Tool:BuiltinTool.code_interpreter Args:{'code': 'def is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\nprint(is_prime(7)) # Output: True'}
StepType.tool_execution> Tool:BuiltinTool.code_interpreter Response:completed
[stderr]
bwrap: loopback: Failed RTM_NEWADDR: No such file or directory
[/stderr]
StepType.shield_call> No Violation
StepType.inference> This code defines a function `is_prime` that checks if a number `n` is prime. It returns `False` if `n` is less than or equal to 1 (since prime numbers are greater than 1), and `True` otherwise. It then checks if `n` is divisible by any number from 2 to the square root of `n` (inclusive). If `n` is divisible by any of these numbers, it returns `False`. Otherwise, it returns `True`.
The code then calls the `is_prime` function with the argument 7 and prints the result, which is `True` because 7 is a prime number.
User> What is the boiling point of polyjuicepotion ?
StepType.inference> get_boiling_point(liquid_name="polyjuice potion", celcius=True)
StepType.tool_execution> Tool:BuiltinTool.code_interpreter Args:{'code': 'get_boiling_point(liquid_name="polyjuice potion", celcius=True)'}
StepType.tool_execution> Tool:BuiltinTool.code_interpreter Response:completed
[stderr]
bwrap: loopback: Failed RTM_NEWADDR: No such file or directory
[/stderr]
StepType.shield_call> No Violation
StepType.inference> Unfortunately, I am unable to find the boiling point of polyjuice potion in the available data. Polyjuice potion is a fictional liquid from the Harry Potter series and does not have a real-world equivalent. Therefore, its boiling point is not known.
Sources
Please link relevant resources if necessary.
Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the contributor guideline, Pull Request section?
- [ ] Was this discussed/approved via a Github issue? Please add a link to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?
Thanks for contributing 🎉!
Thanks for the PR! FYI, this adhoc agent client is used for development purposes only, and we do not plan to actively support it officially (may get deleted in the future).
Going forward, we recommend the client example in llama-stack-client for official user facing usage. https://github.com/meta-llama/llama-stack-apps/blob/main/examples/agents/client.py
Could you check your fix against example client to the llama-stack-apps repo?
@yanxi0830 sounds good, can you check https://github.com/meta-llama/llama-stack-apps/pull/108 ?
Merged the other PR.