Commit graph

10 commits

Author SHA1 Message Date
Hardik Shah
f1faa9c924 pop fix 2025-01-16 14:09:59 -08:00
Dinesh Yeduguru
fcd1a57429 update notebook 2025-01-16 14:00:48 -08:00
Hardik Shah
74e4d520ac un-skip telemetry cells in notebook 2025-01-16 11:54:25 -08:00
Hardik Shah
17fd2d2fd0
Make notebook testable (#780)
# What does this PR do?

This PR updates the notebook to run as a pytest by using a package
called `nbval`.

- [ ] Addresses issue (#issue)


## Test Plan
```
pytest -v -s --nbval-lax  docs/notebooks/Llama_Stack_Building_AI_Applications.ipynb

=================================== test session starts ====================================
platform linux -- Python 3.10.16, pytest-8.3.4, pluggy-1.5.0 -- /home/hjshah/.conda/envs/nbeval/bin/python
cachedir: .pytest_cache
rootdir: /home/hjshah/git/llama-stack
configfile: pyproject.toml
plugins: nbval-0.11.0, anyio-4.8.0
collected 20 items                                                                         

docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 0 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 1 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 2 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 3 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 4 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 5 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 6 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 7 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 8 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 9 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 10 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 11 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 12 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 13 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 14 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 15 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 16 PASSED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 17 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 18 SKIPPED
docs/notebooks/Llama_Stack_Building_AI_Applications::ipynb::Cell 19 PASSED

========================= 14 passed, 6 skipped in 89.69s (0:01:29) =========================
```

---------

Co-authored-by: Hardik Shah <hjshah@fb.com>
2025-01-15 19:28:17 -08:00
Hardik Shah
a51c8b4efc
Convert SamplingParams.strategy to a union (#767)
# What does this PR do?

Cleans up how we provide sampling params. Earlier, strategy was an enum
and all params (top_p, temperature, top_k) across all strategies were
grouped. We now have a strategy union object with each strategy (greedy,
top_p, top_k) having its corresponding params.
Earlier, 
```
class SamplingParams: 
    strategy: enum ()
    top_p, temperature, top_k and other params
```
However, the `strategy` field was not being used in any providers making
it confusing to know the exact sampling behavior purely based on the
params since you could pass temperature, top_p, top_k and how the
provider would interpret those would not be clear.

Hence we introduced -- a union where the strategy and relevant params
are all clubbed together to avoid this confusion.

Have updated all providers, tests, notebooks, readme and otehr places
where sampling params was being used to use the new format.
   

## Test Plan
`pytest llama_stack/providers/tests/inference/groq/test_groq_utils.py`
// inference on ollama, fireworks and together 
`with-proxy pytest -v -s -k "ollama"
--inference-model="meta-llama/Llama-3.1-8B-Instruct"
llama_stack/providers/tests/inference/test_text_inference.py `
// agents on fireworks 
`pytest -v -s -k 'fireworks and create_agent'
--inference-model="meta-llama/Llama-3.1-8B-Instruct"
llama_stack/providers/tests/agents/test_agents.py
--safety-shield="meta-llama/Llama-Guard-3-8B"`

## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the
other checks if that's the case).
- [X] Ran pre-commit to handle lint / formatting issues.
- [X] Read the [contributor
guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md),
      Pull Request section?
- [X] Updated relevant documentation.
- [X] Wrote necessary unit or integration tests.

---------

Co-authored-by: Hardik Shah <hjshah@fb.com>
2025-01-15 05:38:51 -08:00
Dinesh Yeduguru
6964510dc1
update notebook to use new tool defs (#745)
# What does this PR do?

Update notebook for new tool defs
2025-01-13 15:07:15 -08:00
Dinesh Yeduguru
a5c57cd381
agents to use tools api (#673)
# What does this PR do?

PR #639 introduced the notion of Tools API and ability to invoke tools
through API just as any resource. This PR changes the Agents to start
using the Tools API to invoke tools. Major changes include:
1) Ability to specify tool groups with AgentConfig
2) Agent gets the corresponding tool definitions for the specified tools
and pass along to the model
3) Attachements are now named as Documents and their behavior is mostly
unchanged from user perspective
4) You can specify args that can be injected to a tool call through
Agent config. This is especially useful in case of memory tool, where
you want the tool to operate on a specific memory bank.
5) You can also register tool groups with args, which lets the agent
inject these as well into the tool call.
6) All tests have been migrated to use new tools API and fixtures
including client SDK tests
7) Telemetry just works with tools API because of our trace protocol
decorator


## Test Plan
```
pytest -s -v -k fireworks llama_stack/providers/tests/agents/test_agents.py  \
   --safety-shield=meta-llama/Llama-Guard-3-8B \
   --inference-model=meta-llama/Llama-3.1-8B-Instruct

pytest -s -v -k together  llama_stack/providers/tests/tools/test_tools.py \
   --safety-shield=meta-llama/Llama-Guard-3-8B \
   --inference-model=meta-llama/Llama-3.1-8B-Instruct

LLAMA_STACK_CONFIG="/Users/dineshyv/.llama/distributions/llamastack-together/together-run.yaml" pytest -v tests/client-sdk/agents/test_agents.py
```
run.yaml:
https://gist.github.com/dineshyv/0365845ad325e1c2cab755788ccc5994

Notebook:
https://colab.research.google.com/drive/1ck7hXQxRl6UvT-ijNRZ-gMZxH1G3cN2d?usp=sharing
2025-01-08 19:01:00 -08:00
Ashwin Bharambe
b438e616ff kill api key from notebook 2025-01-02 11:26:19 -08:00
Ashwin Bharambe
2f9fdb0ea7 Update notebook 2024-12-17 18:52:02 -08:00
Xi Yan
815f4af6cf
add colab notebook & update docs (#619)
# What does this PR do?

- add notebooks
- restructure docs

## Test Plan
<img width="1201" alt="image"
src="https://github.com/user-attachments/assets/3f9a09d9-b5ec-406c-b44b-e896e340d209"
/>

<img width="1202" alt="image"
src="https://github.com/user-attachments/assets/fdc1173f-2417-4ad6-845e-4f265fc40a31"
/>

<img width="1201" alt="image"
src="https://github.com/user-attachments/assets/b1e4e2a8-acf6-4ef2-a2fc-00d26cf32359"
/>


## Sources

Please link relevant resources if necessary.


## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the
other checks if that's the case).
- [ ] Ran pre-commit to handle lint / formatting issues.
- [ ] Read the [contributor
guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md),
      Pull Request section?
- [ ] Updated relevant documentation.
- [ ] Wrote necessary unit or integration tests.
2024-12-13 19:15:15 -08:00