Skip to content

Commit edca86e

Browse files
authored
feat: v0.1.1 api update (#32)
* v0.1.1 api update
1 parent ab044d8 commit edca86e

16 files changed

+227
-17
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 4
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/meta%2Fllama-api-523cd3430612401b62f89ad02b15c6cec54309d0eb15ac5d939793aa462324f5.yml
3-
openapi_spec_hash: 4968f03f83af0911ee54c3d787b8cb27
4-
config_hash: fe3f7f16ffbaf1c57f5d4182093905e0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/meta%2Fllama-api-bfa0267b010dcc4b39e62dfbd698ac6f9421f3212c44b3408b9b154bd6c67a8b.yml
3+
openapi_spec_hash: 7f424537bc7ea7638e3934ef721b8d71
4+
config_hash: 3ae62c8625d97ed8a867ab369f591724

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Llama API Client please follow the respective company's security reporting guidelines.
19+
or products provided by Llama API Client, please follow the respective company's security reporting guidelines.
2020

2121
### Llama API Client Terms and Policies
2222

23-
Please contact dev-feedback@llama-api.com for any questions or concerns regarding security of our services.
23+
Please contact support@llama.developer.meta.com for any questions or concerns regarding the security of our services.
2424

2525
---
2626

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "llama_api_client"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "The official Python library for the llama-api-client API"
55
dynamic = ["readme"]
66
license = "MIT"
77
authors = [
8-
{ name = "Llama API Client", email = "dev-feedback@llama-api.com" },
8+
{ name = "Llama API Client", email = "support@llama.developer.meta.com" },
99
]
1010
dependencies = [
1111
"httpx>=0.23.0, <1",

scripts/utils/upload-artifact.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
RESPONSE=$(curl -X POST "$URL" \
5+
-H "Authorization: Bearer $AUTH" \
6+
-H "Content-Type: application/json")
7+
8+
SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')
9+
10+
if [[ "$SIGNED_URL" == "null" ]]; then
11+
echo -e "\033[31mFailed to get signed URL.\033[0m"
12+
exit 1
13+
fi
14+
15+
UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
16+
-H "Content-Type: application/gzip" \
17+
--data-binary @- "$SIGNED_URL" 2>&1)
18+
19+
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
20+
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
21+
echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/llama-api-python/$SHA'\033[0m"
22+
else
23+
echo -e "\033[31mFailed to upload artifact.\033[0m"
24+
exit 1
25+
fi

src/llama_api_client/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
import typing as _t
4+
35
from . import types
46
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
57
from ._utils import file_from_path
@@ -78,6 +80,9 @@
7880
"DefaultAsyncHttpxClient",
7981
]
8082

83+
if not _t.TYPE_CHECKING:
84+
from ._utils._resources_proxy import resources as resources
85+
8186
_setup_logging()
8287

8388
# Update the __module__ attribute for exported symbols so that

src/llama_api_client/_utils/_proxy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
4646
@property # type: ignore
4747
@override
4848
def __class__(self) -> type: # pyright: ignore
49-
proxied = self.__get_proxied__()
49+
try:
50+
proxied = self.__get_proxied__()
51+
except Exception:
52+
return type(self)
5053
if issubclass(type(proxied), LazyProxy):
5154
return type(proxied)
5255
return proxied.__class__
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from __future__ import annotations
2+
3+
from typing import Any
4+
from typing_extensions import override
5+
6+
from ._proxy import LazyProxy
7+
8+
9+
class ResourcesProxy(LazyProxy[Any]):
10+
"""A proxy for the `llama_api_client.resources` module.
11+
12+
This is used so that we can lazily import `llama_api_client.resources` only when
13+
needed *and* so that users can just import `llama_api_client` and reference `llama_api_client.resources`
14+
"""
15+
16+
@override
17+
def __load__(self) -> Any:
18+
import importlib
19+
20+
mod = importlib.import_module("llama_api_client.resources")
21+
return mod
22+
23+
24+
resources = ResourcesProxy().__as_proxied__()

src/llama_api_client/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "llama_api_client"
4-
__version__ = "0.0.1-alpha.0"
4+
__version__ = "0.1.1"

src/llama_api_client/resources/chat/completions.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ def create(
5858
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
5959
stream: Literal[False] | NotGiven = NOT_GIVEN,
6060
temperature: float | NotGiven = NOT_GIVEN,
61+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
6162
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
6263
top_k: int | NotGiven = NOT_GIVEN,
6364
top_p: float | NotGiven = NOT_GIVEN,
65+
user: str | NotGiven = NOT_GIVEN,
6466
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6567
# The extra values given here take precedence over values defined on the client or passed to this method.
6668
extra_headers: Headers | None = None,
@@ -92,13 +94,25 @@ def create(
9294
to more creative responses. Lower values will make the response more focused and
9395
deterministic.
9496
97+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
98+
not call any tool and instead generates a message. `auto` means the model can
99+
pick between generating a message or calling one or more tools. `required` means
100+
the model must call one or more tools. Specifying a particular tool via
101+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
102+
call that tool.
103+
104+
`none` is the default when no tools are present. `auto` is the default if tools
105+
are present.
106+
95107
tools: List of tool definitions available to the model
96108
97109
top_k: Only sample from the top K options for each subsequent token.
98110
99111
top_p: Controls diversity of the response by setting a probability threshold when
100112
choosing the next token.
101113
114+
user: A unique identifier representing your application end-user for monitoring abuse.
115+
102116
extra_headers: Send extra headers
103117
104118
extra_query: Add additional query parameters to the request
@@ -120,9 +134,11 @@ def create(
120134
repetition_penalty: float | NotGiven = NOT_GIVEN,
121135
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
122136
temperature: float | NotGiven = NOT_GIVEN,
137+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
123138
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
124139
top_k: int | NotGiven = NOT_GIVEN,
125140
top_p: float | NotGiven = NOT_GIVEN,
141+
user: str | NotGiven = NOT_GIVEN,
126142
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
127143
# The extra values given here take precedence over values defined on the client or passed to this method.
128144
extra_headers: Headers | None = None,
@@ -154,13 +170,25 @@ def create(
154170
to more creative responses. Lower values will make the response more focused and
155171
deterministic.
156172
173+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
174+
not call any tool and instead generates a message. `auto` means the model can
175+
pick between generating a message or calling one or more tools. `required` means
176+
the model must call one or more tools. Specifying a particular tool via
177+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
178+
call that tool.
179+
180+
`none` is the default when no tools are present. `auto` is the default if tools
181+
are present.
182+
157183
tools: List of tool definitions available to the model
158184
159185
top_k: Only sample from the top K options for each subsequent token.
160186
161187
top_p: Controls diversity of the response by setting a probability threshold when
162188
choosing the next token.
163189
190+
user: A unique identifier representing your application end-user for monitoring abuse.
191+
164192
extra_headers: Send extra headers
165193
166194
extra_query: Add additional query parameters to the request
@@ -182,9 +210,11 @@ def create(
182210
repetition_penalty: float | NotGiven = NOT_GIVEN,
183211
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
184212
temperature: float | NotGiven = NOT_GIVEN,
213+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
185214
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
186215
top_k: int | NotGiven = NOT_GIVEN,
187216
top_p: float | NotGiven = NOT_GIVEN,
217+
user: str | NotGiven = NOT_GIVEN,
188218
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
189219
# The extra values given here take precedence over values defined on the client or passed to this method.
190220
extra_headers: Headers | None = None,
@@ -216,13 +246,25 @@ def create(
216246
to more creative responses. Lower values will make the response more focused and
217247
deterministic.
218248
249+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
250+
not call any tool and instead generates a message. `auto` means the model can
251+
pick between generating a message or calling one or more tools. `required` means
252+
the model must call one or more tools. Specifying a particular tool via
253+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
254+
call that tool.
255+
256+
`none` is the default when no tools are present. `auto` is the default if tools
257+
are present.
258+
219259
tools: List of tool definitions available to the model
220260
221261
top_k: Only sample from the top K options for each subsequent token.
222262
223263
top_p: Controls diversity of the response by setting a probability threshold when
224264
choosing the next token.
225265
266+
user: A unique identifier representing your application end-user for monitoring abuse.
267+
226268
extra_headers: Send extra headers
227269
228270
extra_query: Add additional query parameters to the request
@@ -244,9 +286,11 @@ def create(
244286
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
245287
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
246288
temperature: float | NotGiven = NOT_GIVEN,
289+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
247290
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
248291
top_k: int | NotGiven = NOT_GIVEN,
249292
top_p: float | NotGiven = NOT_GIVEN,
293+
user: str | NotGiven = NOT_GIVEN,
250294
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
251295
# The extra values given here take precedence over values defined on the client or passed to this method.
252296
extra_headers: Headers | None = None,
@@ -267,9 +311,11 @@ def create(
267311
"response_format": response_format,
268312
"stream": stream,
269313
"temperature": temperature,
314+
"tool_choice": tool_choice,
270315
"tools": tools,
271316
"top_k": top_k,
272317
"top_p": top_p,
318+
"user": user,
273319
},
274320
completion_create_params.CompletionCreateParamsStreaming
275321
if stream
@@ -315,9 +361,11 @@ async def create(
315361
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
316362
stream: Literal[False] | NotGiven = NOT_GIVEN,
317363
temperature: float | NotGiven = NOT_GIVEN,
364+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
318365
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
319366
top_k: int | NotGiven = NOT_GIVEN,
320367
top_p: float | NotGiven = NOT_GIVEN,
368+
user: str | NotGiven = NOT_GIVEN,
321369
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
322370
# The extra values given here take precedence over values defined on the client or passed to this method.
323371
extra_headers: Headers | None = None,
@@ -349,13 +397,25 @@ async def create(
349397
to more creative responses. Lower values will make the response more focused and
350398
deterministic.
351399
400+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
401+
not call any tool and instead generates a message. `auto` means the model can
402+
pick between generating a message or calling one or more tools. `required` means
403+
the model must call one or more tools. Specifying a particular tool via
404+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
405+
call that tool.
406+
407+
`none` is the default when no tools are present. `auto` is the default if tools
408+
are present.
409+
352410
tools: List of tool definitions available to the model
353411
354412
top_k: Only sample from the top K options for each subsequent token.
355413
356414
top_p: Controls diversity of the response by setting a probability threshold when
357415
choosing the next token.
358416
417+
user: A unique identifier representing your application end-user for monitoring abuse.
418+
359419
extra_headers: Send extra headers
360420
361421
extra_query: Add additional query parameters to the request
@@ -377,9 +437,11 @@ async def create(
377437
repetition_penalty: float | NotGiven = NOT_GIVEN,
378438
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
379439
temperature: float | NotGiven = NOT_GIVEN,
440+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
380441
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
381442
top_k: int | NotGiven = NOT_GIVEN,
382443
top_p: float | NotGiven = NOT_GIVEN,
444+
user: str | NotGiven = NOT_GIVEN,
383445
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
384446
# The extra values given here take precedence over values defined on the client or passed to this method.
385447
extra_headers: Headers | None = None,
@@ -411,13 +473,25 @@ async def create(
411473
to more creative responses. Lower values will make the response more focused and
412474
deterministic.
413475
476+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
477+
not call any tool and instead generates a message. `auto` means the model can
478+
pick between generating a message or calling one or more tools. `required` means
479+
the model must call one or more tools. Specifying a particular tool via
480+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
481+
call that tool.
482+
483+
`none` is the default when no tools are present. `auto` is the default if tools
484+
are present.
485+
414486
tools: List of tool definitions available to the model
415487
416488
top_k: Only sample from the top K options for each subsequent token.
417489
418490
top_p: Controls diversity of the response by setting a probability threshold when
419491
choosing the next token.
420492
493+
user: A unique identifier representing your application end-user for monitoring abuse.
494+
421495
extra_headers: Send extra headers
422496
423497
extra_query: Add additional query parameters to the request
@@ -439,9 +513,11 @@ async def create(
439513
repetition_penalty: float | NotGiven = NOT_GIVEN,
440514
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
441515
temperature: float | NotGiven = NOT_GIVEN,
516+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
442517
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
443518
top_k: int | NotGiven = NOT_GIVEN,
444519
top_p: float | NotGiven = NOT_GIVEN,
520+
user: str | NotGiven = NOT_GIVEN,
445521
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
446522
# The extra values given here take precedence over values defined on the client or passed to this method.
447523
extra_headers: Headers | None = None,
@@ -473,13 +549,25 @@ async def create(
473549
to more creative responses. Lower values will make the response more focused and
474550
deterministic.
475551
552+
tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
553+
not call any tool and instead generates a message. `auto` means the model can
554+
pick between generating a message or calling one or more tools. `required` means
555+
the model must call one or more tools. Specifying a particular tool via
556+
`{"type": "function", "function": {"name": "my_function"}}` forces the model to
557+
call that tool.
558+
559+
`none` is the default when no tools are present. `auto` is the default if tools
560+
are present.
561+
476562
tools: List of tool definitions available to the model
477563
478564
top_k: Only sample from the top K options for each subsequent token.
479565
480566
top_p: Controls diversity of the response by setting a probability threshold when
481567
choosing the next token.
482568
569+
user: A unique identifier representing your application end-user for monitoring abuse.
570+
483571
extra_headers: Send extra headers
484572
485573
extra_query: Add additional query parameters to the request
@@ -501,9 +589,11 @@ async def create(
501589
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
502590
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
503591
temperature: float | NotGiven = NOT_GIVEN,
592+
tool_choice: completion_create_params.ToolChoice | NotGiven = NOT_GIVEN,
504593
tools: Iterable[completion_create_params.Tool] | NotGiven = NOT_GIVEN,
505594
top_k: int | NotGiven = NOT_GIVEN,
506595
top_p: float | NotGiven = NOT_GIVEN,
596+
user: str | NotGiven = NOT_GIVEN,
507597
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
508598
# The extra values given here take precedence over values defined on the client or passed to this method.
509599
extra_headers: Headers | None = None,
@@ -524,9 +614,11 @@ async def create(
524614
"response_format": response_format,
525615
"stream": stream,
526616
"temperature": temperature,
617+
"tool_choice": tool_choice,
527618
"tools": tools,
528619
"top_k": top_k,
529620
"top_p": top_p,
621+
"user": user,
530622
},
531623
completion_create_params.CompletionCreateParamsStreaming
532624
if stream

0 commit comments

Comments
 (0)