Commit ad7aa08
authored
feat: migrate Conversations API to FastAPI router (#4342)
# What does this PR do?
Convert the Conversations API from the legacy @webmethod decorator
system to FastAPI routers, following the established pattern from the
Batches API.
The only notable difference is that now the conversations API is
properly listed when inspecting routes.
Fixes: #4341
## Test Plan
Unit and integration tests:
```
export OPENAI_API_KEY=******
./scripts/integration-tests.sh --stack-config http://localhost:8321 --subdirs conversations --setup gpt
```
Also, inspect endpoint:
```
curl http://localhost:8321/v1/inspect/routes | jq '.data[] | select(.route | contains("conversa"))'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10382 100 10382 0 0 611k 0 --:--:-- --:--:-- --:--:-- 633k
{
"route": "/v1/conversations",
"method": "POST",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}",
"method": "GET",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}",
"method": "POST",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}",
"method": "DELETE",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}/items",
"method": "POST",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}/items/{item_id}",
"method": "GET",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}/items",
"method": "GET",
"provider_types": []
}
{
"route": "/v1/conversations/{conversation_id}/items/{item_id}",
"method": "DELETE",
"provider_types": []
}
```
Signed-off-by: Sébastien Han <seb@redhat.com>1 parent 574ce38 commit ad7aa08
File tree
16 files changed
+1683
-612
lines changed- client-sdks/stainless
- docs/static
- src
- llama_stack_api
- conversations
- llama_stack
- core
- conversations
- server
- providers/inline/agents/meta_reference/responses
- tests/unit
- conversations
- providers/agents/meta_reference
16 files changed
+1683
-612
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2774 | 2774 | | |
2775 | 2775 | | |
2776 | 2776 | | |
| 2777 | + | |
2777 | 2778 | | |
2778 | 2779 | | |
2779 | 2780 | | |
2780 | 2781 | | |
2781 | 2782 | | |
2782 | 2783 | | |
| 2784 | + | |
2783 | 2785 | | |
2784 | 2786 | | |
| 2787 | + | |
2785 | 2788 | | |
2786 | 2789 | | |
2787 | 2790 | | |
| |||
2826 | 2829 | | |
2827 | 2830 | | |
2828 | 2831 | | |
| 2832 | + | |
2829 | 2833 | | |
2830 | 2834 | | |
2831 | 2835 | | |
2832 | 2836 | | |
| 2837 | + | |
2833 | 2838 | | |
2834 | 2839 | | |
2835 | 2840 | | |
| |||
2952 | 2957 | | |
2953 | 2958 | | |
2954 | 2959 | | |
| 2960 | + | |
2955 | 2961 | | |
| 2962 | + | |
2956 | 2963 | | |
2957 | 2964 | | |
2958 | 2965 | | |
2959 | 2966 | | |
| 2967 | + | |
2960 | 2968 | | |
2961 | 2969 | | |
2962 | 2970 | | |
| |||
10790 | 10798 | | |
10791 | 10799 | | |
10792 | 10800 | | |
| 10801 | + | |
| 10802 | + | |
| 10803 | + | |
| 10804 | + | |
| 10805 | + | |
| 10806 | + | |
| 10807 | + | |
| 10808 | + | |
| 10809 | + | |
| 10810 | + | |
| 10811 | + | |
| 10812 | + | |
| 10813 | + | |
| 10814 | + | |
| 10815 | + | |
| 10816 | + | |
| 10817 | + | |
| 10818 | + | |
| 10819 | + | |
| 10820 | + | |
| 10821 | + | |
| 10822 | + | |
| 10823 | + | |
| 10824 | + | |
| 10825 | + | |
| 10826 | + | |
| 10827 | + | |
| 10828 | + | |
| 10829 | + | |
| 10830 | + | |
| 10831 | + | |
| 10832 | + | |
| 10833 | + | |
| 10834 | + | |
| 10835 | + | |
| 10836 | + | |
| 10837 | + | |
| 10838 | + | |
| 10839 | + | |
| 10840 | + | |
| 10841 | + | |
| 10842 | + | |
| 10843 | + | |
| 10844 | + | |
| 10845 | + | |
| 10846 | + | |
| 10847 | + | |
| 10848 | + | |
| 10849 | + | |
| 10850 | + | |
| 10851 | + | |
| 10852 | + | |
| 10853 | + | |
| 10854 | + | |
| 10855 | + | |
| 10856 | + | |
| 10857 | + | |
| 10858 | + | |
| 10859 | + | |
| 10860 | + | |
| 10861 | + | |
| 10862 | + | |
| 10863 | + | |
| 10864 | + | |
| 10865 | + | |
| 10866 | + | |
| 10867 | + | |
| 10868 | + | |
| 10869 | + | |
| 10870 | + | |
| 10871 | + | |
| 10872 | + | |
| 10873 | + | |
| 10874 | + | |
| 10875 | + | |
| 10876 | + | |
| 10877 | + | |
| 10878 | + | |
| 10879 | + | |
| 10880 | + | |
| 10881 | + | |
| 10882 | + | |
| 10883 | + | |
| 10884 | + | |
| 10885 | + | |
| 10886 | + | |
| 10887 | + | |
| 10888 | + | |
| 10889 | + | |
| 10890 | + | |
| 10891 | + | |
| 10892 | + | |
| 10893 | + | |
| 10894 | + | |
10793 | 10895 | | |
10794 | 10896 | | |
10795 | 10897 | | |
| |||
0 commit comments