Skip to content

Commit 5e021c7

Browse files
committed
Export VertexAIError from api instead of public types
1 parent 5d32105 commit 5e021c7

File tree

10 files changed

+14
-11
lines changed

10 files changed

+14
-11
lines changed

packages/vertexai/src/api.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { ModelParams, VertexAIError, VertexAIErrorCode } from './types';
17+
import { ModelParams, VertexAIErrorCode } from './types';
18+
import { VertexAIError } from './errors';
1819
import { getGenerativeModel } from './api';
1920
import { expect } from 'chai';
2021
import { VertexAI } from './public-types';

packages/vertexai/src/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ import { VertexAI, VertexAIOptions } from './public-types';
2424
import {
2525
ModelParams,
2626
RequestOptions,
27-
VertexAIError,
2827
VertexAIErrorCode
2928
} from './types';
29+
import { VertexAIError } from './errors';
3030
import { GenerativeModel } from './models/generative-model';
3131

3232
export { ChatSession } from './methods/chat-session';
3333

3434
export { GenerativeModel };
3535

36+
export { VertexAIError } from './errors';
37+
3638
declare module '@firebase/component' {
3739
interface NameServiceMapping {
3840
[VERTEX_TYPE]: VertexAIService;

packages/vertexai/src/methods/chat-session-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import {
2020
POSSIBLE_ROLES,
2121
Part,
2222
Role,
23-
VertexAIError,
2423
VertexAIErrorCode
2524
} from '../types';
25+
import { VertexAIError } from '../errors';
2626

2727
// https://ai.google.dev/api/rest/v1beta/Content#part
2828

packages/vertexai/src/models/generative-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import {
3434
StartChatParams,
3535
Tool,
3636
ToolConfig,
37-
VertexAIError,
3837
VertexAIErrorCode
3938
} from '../types';
39+
import { VertexAIError } from '../errors';
4040
import { ChatSession } from '../methods/chat-session';
4141
import { countTokens } from '../methods/count-tokens';
4242
import {

packages/vertexai/src/requests/request-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import {
1919
Content,
2020
GenerateContentRequest,
2121
Part,
22-
VertexAIError,
2322
VertexAIErrorCode
2423
} from '../types';
24+
import { VertexAIError } from '../errors';
2525

2626
export function formatSystemInstruction(
2727
input?: string | Part | Content

packages/vertexai/src/requests/request.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import chaiAsPromised from 'chai-as-promised';
2222
import { RequestUrl, Task, getHeaders, makeRequest } from './request';
2323
import { ApiSettings } from '../types/internal';
2424
import { DEFAULT_API_VERSION } from '../constants';
25-
import { VertexAIError, VertexAIErrorCode } from '../types';
25+
import { VertexAIErrorCode } from '../types';
26+
import { VertexAIError } from '../errors';
2627

2728
use(sinonChai);
2829
use(chaiAsPromised);

packages/vertexai/src/requests/request.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { RequestOptions, VertexAIError, VertexAIErrorCode } from '../types';
18+
import { RequestOptions, VertexAIErrorCode } from '../types';
19+
import { VertexAIError } from '../errors';
1920
import { ApiSettings } from '../types/internal';
2021
import {
2122
DEFAULT_API_VERSION,

packages/vertexai/src/requests/response-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import {
2121
FunctionCall,
2222
GenerateContentCandidate,
2323
GenerateContentResponse,
24-
VertexAIError,
2524
VertexAIErrorCode
2625
} from '../types';
26+
import { VertexAIError } from '../errors';
2727

2828
/**
2929
* Adds convenience helper methods to a response object, including stream

packages/vertexai/src/requests/stream-reader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import {
2121
GenerateContentResponse,
2222
GenerateContentStreamResult,
2323
Part,
24-
VertexAIError,
2524
VertexAIErrorCode
2625
} from '../types';
26+
import { VertexAIError } from '../errors';
2727
import { addHelpers } from './response-helpers';
2828

2929
const responseLineRE = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;

packages/vertexai/src/types/error.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,3 @@ export const enum VertexAIErrorCode {
9090
/** An error occured while parsing. */
9191
PARSE_FAILED = 'parse-failed'
9292
}
93-
94-
export { VertexAIError } from '../errors';

0 commit comments

Comments
 (0)