Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lucky-socks-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/ai': minor
'firebase': minor
---

Added Code Execution feature.
105 changes: 103 additions & 2 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,39 @@ export interface CitationMetadata {
citations: Citation[];
}

// @public
export interface CodeExecutionResult {
outcome?: Outcome;
output?: string;
}

// @public
export interface CodeExecutionResultPart {
// (undocumented)
codeExecutionResult?: CodeExecutionResult;
// (undocumented)
executableCode?: never;
// (undocumented)
fileData: never;
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData?: never;
// (undocumented)
text?: never;
// (undocumented)
thought?: never;
// @internal (undocumented)
thoughtSignature?: never;
}

// @public
export interface CodeExecutionTool {
codeExecution: {};
}

// @public
export interface Content {
// (undocumented)
Expand Down Expand Up @@ -237,6 +270,34 @@ export interface ErrorDetails {
reason?: string;
}

// @public
export interface ExecutableCode {
code?: string;
language?: Language;
}

// @public
export interface ExecutableCodePart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: ExecutableCode;
// (undocumented)
fileData: never;
// (undocumented)
functionCall?: never;
// (undocumented)
functionResponse?: never;
// (undocumented)
inlineData?: never;
// (undocumented)
text?: never;
// (undocumented)
thought?: never;
// @internal (undocumented)
thoughtSignature?: never;
}

// @public
export interface FileData {
// (undocumented)
Expand All @@ -247,6 +308,10 @@ export interface FileData {

// @public
export interface FileDataPart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: never;
// (undocumented)
fileData: FileData;
// (undocumented)
Expand Down Expand Up @@ -308,6 +373,10 @@ export type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof Func

// @public
export interface FunctionCallPart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: never;
// (undocumented)
functionCall: FunctionCall;
// (undocumented)
Expand Down Expand Up @@ -345,6 +414,10 @@ export interface FunctionResponse {

// @public
export interface FunctionResponsePart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: never;
// (undocumented)
functionCall?: never;
// (undocumented)
Expand Down Expand Up @@ -735,6 +808,10 @@ export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];

// @public
export interface InlineDataPart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: never;
// (undocumented)
functionCall?: never;
// (undocumented)
Expand All @@ -755,6 +832,15 @@ export class IntegerSchema extends Schema {
constructor(schemaParams?: SchemaParams);
}

// @public
export const Language: {
UNSPECIFIED: string;
PYTHON: string;
};

// @public
export type Language = (typeof Language)[keyof typeof Language];

// @public
export interface LanguageModelCreateCoreOptions {
// (undocumented)
Expand Down Expand Up @@ -969,7 +1055,18 @@ export interface OnDeviceParams {
}

// @public
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
export const Outcome: {
UNSPECIFIED: string;
OK: string;
FAILED: string;
DEADLINE_EXCEEDED: string;
};

// @public
export type Outcome = (typeof Outcome)[keyof typeof Outcome];

// @public
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;

// @public
export const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];
Expand Down Expand Up @@ -1179,6 +1276,10 @@ export class StringSchema extends Schema {

// @public
export interface TextPart {
// (undocumented)
codeExecutionResult?: never;
// (undocumented)
executableCode?: never;
// (undocumented)
functionCall?: never;
// (undocumented)
Expand All @@ -1200,7 +1301,7 @@ export interface ThinkingConfig {
}

// @public
export type Tool = FunctionDeclarationsTool | GoogleSearchTool;
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;

// @public
export interface ToolConfig {
Expand Down
10 changes: 10 additions & 0 deletions docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ toc:
path: /docs/reference/js/ai.citation.md
- title: CitationMetadata
path: /docs/reference/js/ai.citationmetadata.md
- title: CodeExecutionResult
path: /docs/reference/js/ai.codeexecutionresult.md
- title: CodeExecutionResultPart
path: /docs/reference/js/ai.codeexecutionresultpart.md
- title: CodeExecutionTool
path: /docs/reference/js/ai.codeexecutiontool.md
- title: Content
path: /docs/reference/js/ai.content.md
- title: CountTokensRequest
Expand All @@ -46,6 +52,10 @@ toc:
path: /docs/reference/js/ai.enhancedgeneratecontentresponse.md
- title: ErrorDetails
path: /docs/reference/js/ai.errordetails.md
- title: ExecutableCode
path: /docs/reference/js/ai.executablecode.md
- title: ExecutableCodePart
path: /docs/reference/js/ai.executablecodepart.md
- title: FileData
path: /docs/reference/js/ai.filedata.md
- title: FileDataPart
Expand Down
46 changes: 46 additions & 0 deletions docs-devsite/ai.codeexecutionresult.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# CodeExecutionResult interface
The results of code execution run by the model.

<b>Signature:</b>

```typescript
export interface CodeExecutionResult
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [outcome](./ai.codeexecutionresult.md#codeexecutionresultoutcome) | [Outcome](./ai.md#outcome) | The result of the code execution. |
| [output](./ai.codeexecutionresult.md#codeexecutionresultoutput) | string | The output from the code execution, or an error message if it failed. |

## CodeExecutionResult.outcome

The result of the code execution.

<b>Signature:</b>

```typescript
outcome?: Outcome;
```

## CodeExecutionResult.output

The output from the code execution, or an error message if it failed.

<b>Signature:</b>

```typescript
output?: string;
```
96 changes: 96 additions & 0 deletions docs-devsite/ai.codeexecutionresultpart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# CodeExecutionResultPart interface
Represents the code execution result from the model.

<b>Signature:</b>

```typescript
export interface CodeExecutionResultPart
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [codeExecutionResult](./ai.codeexecutionresultpart.md#codeexecutionresultpartcodeexecutionresult) | [CodeExecutionResult](./ai.codeexecutionresult.md#codeexecutionresult_interface) | |
| [executableCode](./ai.codeexecutionresultpart.md#codeexecutionresultpartexecutablecode) | never | |
| [fileData](./ai.codeexecutionresultpart.md#codeexecutionresultpartfiledata) | never | |
| [functionCall](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctioncall) | never | |
| [functionResponse](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctionresponse) | never | |
| [inlineData](./ai.codeexecutionresultpart.md#codeexecutionresultpartinlinedata) | never | |
| [text](./ai.codeexecutionresultpart.md#codeexecutionresultparttext) | never | |
| [thought](./ai.codeexecutionresultpart.md#codeexecutionresultpartthought) | never | |

## CodeExecutionResultPart.codeExecutionResult

<b>Signature:</b>

```typescript
codeExecutionResult?: CodeExecutionResult;
```

## CodeExecutionResultPart.executableCode

<b>Signature:</b>

```typescript
executableCode?: never;
```

## CodeExecutionResultPart.fileData

<b>Signature:</b>

```typescript
fileData: never;
```

## CodeExecutionResultPart.functionCall

<b>Signature:</b>

```typescript
functionCall?: never;
```

## CodeExecutionResultPart.functionResponse

<b>Signature:</b>

```typescript
functionResponse?: never;
```

## CodeExecutionResultPart.inlineData

<b>Signature:</b>

```typescript
inlineData?: never;
```

## CodeExecutionResultPart.text

<b>Signature:</b>

```typescript
text?: never;
```

## CodeExecutionResultPart.thought

<b>Signature:</b>

```typescript
thought?: never;
```
35 changes: 35 additions & 0 deletions docs-devsite/ai.codeexecutiontool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# CodeExecutionTool interface
A tool that enables the model to use code execution.

<b>Signature:</b>

```typescript
export interface CodeExecutionTool
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [codeExecution](./ai.codeexecutiontool.md#codeexecutiontoolcodeexecution) | {} | Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. |

## CodeExecutionTool.codeExecution

Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options.

<b>Signature:</b>

```typescript
codeExecution: {};
```
Loading
Loading