Skip to content

Commit 7b53f7c

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): codegen related update (#105)
1 parent c08717b commit 7b53f7c

File tree

8 files changed

+40
-17
lines changed

8 files changed

+40
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
pull_request:
77
branches:
88
- main
9+
- next
910

1011
jobs:
1112
lint:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.prism.log
12
node_modules
23
yarn-error.log
34
codegen.log

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This library provides convenient access to the Groq REST API from server-side TypeScript or JavaScript.
66

7-
The REST API documentation can be found [on console.groq.com](https://console.groq.com/docs). The full API of this library can be found in [api.md](api.md).
7+
The REST API documentation can be found on [console.groq.com](https://console.groq.com/docs). The full API of this library can be found in [api.md](api.md).
88

99
It is generated with [Stainless](https://www.stainlessapi.com/).
1010

@@ -329,6 +329,18 @@ The following runtimes are supported:
329329
- Vercel Edge Runtime.
330330
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
331331
- Nitro v2.6 or greater.
332+
- Web browsers: disabled by default to avoid exposing your secret API credentials. Enable browser support by explicitly setting `dangerouslyAllowBrowser` to true'.
333+
<details>
334+
<summary>More explanation</summary>
335+
### Why is this dangerous?
336+
Enabling the `dangerouslyAllowBrowser` option can be dangerous because it exposes your secret API credentials in the client-side code. Web browsers are inherently less secure than server environments,
337+
any user with access to the browser can potentially inspect, extract, and misuse these credentials. This could lead to unauthorized access using your credentials and potentially compromise sensitive data or functionality.
338+
### When might this not be dangerous?
339+
In certain scenarios where enabling browser support might not pose significant risks:
340+
- Internal Tools: If the application is used solely within a controlled internal environment where the users are trusted, the risk of credential exposure can be mitigated.
341+
- Public APIs with Limited Scope: If your API has very limited scope and the exposed credentials do not grant access to sensitive data or critical operations, the potential impact of exposure is reduced.
342+
- Development or debugging purpose: Enabling this feature temporarily might be acceptable, provided the credentials are short-lived, aren't also used in production environments, or are frequently rotated.
343+
</details>
332344

333345
Note that React Native is not supported at this time.
334346

tests/api-resources/audio/transcriptions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('resource transcriptions', () => {
2828
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
2929
model: 'whisper-large-v3',
3030
language: 'string',
31-
prompt: 'string',
31+
prompt: 'prompt',
3232
response_format: 'json',
3333
temperature: 0,
3434
timestamp_granularities: ['word', 'segment'],

tests/api-resources/audio/translations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('resource translations', () => {
2727
const response = await groq.audio.translations.create({
2828
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
2929
model: 'whisper-1',
30-
prompt: 'string',
30+
prompt: 'prompt',
3131
response_format: 'json',
3232
temperature: 0,
3333
});

tests/api-resources/chat/completions.test.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const groq = new Groq({
1111
describe('resource completions', () => {
1212
test('create: only required params', async () => {
1313
const responsePromise = groq.chat.completions.create({
14-
messages: [{ content: 'string', role: 'system' }],
14+
messages: [{ content: 'content', role: 'system' }],
1515
model: 'string',
1616
});
1717
const rawResponse = await responsePromise.asResponse();
@@ -25,14 +25,14 @@ describe('resource completions', () => {
2525

2626
test('create: required and optional params', async () => {
2727
const response = await groq.chat.completions.create({
28-
messages: [{ content: 'string', role: 'system', name: 'string', tool_call_id: 'string' }],
28+
messages: [{ content: 'content', role: 'system', name: 'name', tool_call_id: 'tool_call_id' }],
2929
model: 'string',
3030
frequency_penalty: -2,
3131
function_call: 'none',
3232
functions: [
33-
{ description: 'string', name: 'string', parameters: { foo: 'bar' } },
34-
{ description: 'string', name: 'string', parameters: { foo: 'bar' } },
35-
{ description: 'string', name: 'string', parameters: { foo: 'bar' } },
33+
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
34+
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
35+
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
3636
],
3737
logit_bias: { foo: 0 },
3838
logprobs: true,
@@ -48,13 +48,22 @@ describe('resource completions', () => {
4848
temperature: 1,
4949
tool_choice: 'none',
5050
tools: [
51-
{ type: 'function', function: { description: 'string', name: 'string', parameters: { foo: 'bar' } } },
52-
{ type: 'function', function: { description: 'string', name: 'string', parameters: { foo: 'bar' } } },
53-
{ type: 'function', function: { description: 'string', name: 'string', parameters: { foo: 'bar' } } },
51+
{
52+
type: 'function',
53+
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
54+
},
55+
{
56+
type: 'function',
57+
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
58+
},
59+
{
60+
type: 'function',
61+
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
62+
},
5463
],
5564
top_logprobs: 0,
5665
top_p: 1,
57-
user: 'string',
66+
user: 'user',
5867
});
5968
});
6069
});

tests/api-resources/embeddings.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('resource embeddings', () => {
2828
input: 'The quick brown fox jumped over the lazy dog',
2929
model: 'nomic-embed-text-v1_5',
3030
encoding_format: 'float',
31-
user: 'string',
31+
user: 'user',
3232
});
3333
});
3434
});

tests/api-resources/models.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const groq = new Groq({
1010

1111
describe('resource models', () => {
1212
test('retrieve', async () => {
13-
const responsePromise = groq.models.retrieve('string');
13+
const responsePromise = groq.models.retrieve('model');
1414
const rawResponse = await responsePromise.asResponse();
1515
expect(rawResponse).toBeInstanceOf(Response);
1616
const response = await responsePromise;
@@ -22,7 +22,7 @@ describe('resource models', () => {
2222

2323
test('retrieve: request options instead of params are passed correctly', async () => {
2424
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
25-
await expect(groq.models.retrieve('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
25+
await expect(groq.models.retrieve('model', { path: '/_stainless_unknown_path' })).rejects.toThrow(
2626
Groq.NotFoundError,
2727
);
2828
});
@@ -44,7 +44,7 @@ describe('resource models', () => {
4444
});
4545

4646
test('delete', async () => {
47-
const responsePromise = groq.models.delete('string');
47+
const responsePromise = groq.models.delete('model');
4848
const rawResponse = await responsePromise.asResponse();
4949
expect(rawResponse).toBeInstanceOf(Response);
5050
const response = await responsePromise;
@@ -56,7 +56,7 @@ describe('resource models', () => {
5656

5757
test('delete: request options instead of params are passed correctly', async () => {
5858
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
59-
await expect(groq.models.delete('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
59+
await expect(groq.models.delete('model', { path: '/_stainless_unknown_path' })).rejects.toThrow(
6060
Groq.NotFoundError,
6161
);
6262
});

0 commit comments

Comments
 (0)