Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-nuxt-h3-https-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
amh4r committed Dec 7, 2024
2 parents 6eb42e1 + ad6ae39 commit 928ab83
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 4 deletions.
24 changes: 24 additions & 0 deletions packages/inngest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# inngest

## 3.27.4

### Patch Changes

- [#770](https://github.com/inngest/inngest-js/pull/770) [`3aab141`](https://github.com/inngest/inngest-js/commit/3aab1410e5d45d71404694bef0067a978b1fceae) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Widen the `AiAdapter` types to allow for easy overrides

## 3.27.3

### Patch Changes

- [#768](https://github.com/inngest/inngest-js/pull/768) [`af66ad5`](https://github.com/inngest/inngest-js/commit/af66ad5552dc93d41756ab3b913ceafb72739f77) Thanks [@charlypoly](https://github.com/charlypoly)! - Add `o1-preview` and `o1-mini` to possible OpenAI models

## 3.27.2

### Patch Changes

- [#766](https://github.com/inngest/inngest-js/pull/766) [`fa74c6a`](https://github.com/inngest/inngest-js/commit/fa74c6aefdd3c129ad0e5000e1b869f3507980f1) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Add missing `finish_reason` to OpenAI output types

## 3.27.1

### Patch Changes

- [#764](https://github.com/inngest/inngest-js/pull/764) [`1358b80`](https://github.com/inngest/inngest-js/commit/1358b80c758e85bc61e3f9aaa38e72af4bd1b44e) Thanks [@tonyhb](https://github.com/tonyhb)! - Add max_tokens as a param for anthropic model providers

## 3.27.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/inngest/jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@inngest/sdk",
"description": "Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.",
"version": "3.27.0",
"version": "3.27.4",
"include": [
"./src/**/*.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/inngest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inngest",
"version": "3.27.0",
"version": "3.27.4",
"description": "Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
17 changes: 17 additions & 0 deletions packages/inngest/src/components/ai/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export interface AiAdapter {
*/
format: AiAdapter.Format;

/**
* The constructor options for the adapter.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: any;

/**
* The input and output types for this AI I/O format.
*
Expand Down Expand Up @@ -79,6 +85,17 @@ export interface AiAdapter {
* types.
*/
export namespace AiAdapter {
export interface Any extends Omit<AiAdapter, "format"> {
/**
* The I/O format for the adapter.
*
* Allows any value, such that this type can be easily used with any
* adapter.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
format: any;
}

/**
* A helper used to infer the input type of an adapter.
*/
Expand Down
10 changes: 10 additions & 0 deletions packages/inngest/src/components/ai/adapters/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,16 @@ export interface OpenAiAiAdapter extends AiAdapter {
* greater than 1.
*/
choices: {
/**
* The reason the model stopped generating tokens. This will be `stop`
* if the model hit a natural stop point or a provided stop sequence,
* `length` if the maximum number of tokens specified in the request was
* reached, `content_filter` if content was omitted due to a flag from
* our content filters, `tool_calls` if the model called a tool, or
* `function_call` (deprecated) if the model called a function.
*/
finish_reason: string;

/**
* The index of the choice in the list of choices.
*/
Expand Down
11 changes: 10 additions & 1 deletion packages/inngest/src/components/ai/models/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export const anthropic: AiAdapter.ModelCreator<
format: "anthropic",
onCall(_, body) {
body.model ||= options.model;
body.max_tokens ||= options.max_tokens;
},
headers,
options,
} as Anthropic.AiModel;
};

Expand All @@ -62,6 +64,11 @@ export namespace Anthropic {
*/
model: Model;

/**
* The maximum number of tokens to generate before stopping.
*/
max_tokens: number;

/**
* The Anthropic API key to use for authenticating your request. By default
* we'll search for and use the `ANTHROPIC_API_KEY` environment variable.
Expand All @@ -85,5 +92,7 @@ export namespace Anthropic {
/**
* An Anthropic model using the Anthropic format for I/O.
*/
export type AiModel = AnthropicAiAdapter;
export interface AiModel extends AnthropicAiAdapter {
options: AiModelOptions;
}
}
7 changes: 6 additions & 1 deletion packages/inngest/src/components/ai/models/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const openai: AiAdapter.ModelCreator<
onCall(_, body) {
body.model ||= options.model;
},
options,
} as OpenAi.AiModel;
};

Expand All @@ -44,6 +45,8 @@ export namespace OpenAi {
| "chatgpt-4o-latest"
| "gpt-4o-mini"
| "gpt-4"
| "o1-preview"
| "o1-mini"
| "gpt-3.5-turbo";

/**
Expand Down Expand Up @@ -74,5 +77,7 @@ export namespace OpenAi {
/**
* An OpenAI model using the OpenAI format for I/O.
*/
export type AiModel = OpenAiAiAdapter;
export interface AiModel extends OpenAiAiAdapter {
options: AiModelOptions;
}
}

0 comments on commit 928ab83

Please sign in to comment.