Skip to content

Commit

Permalink
Fix types (#6313)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 authored Aug 1, 2024
1 parent 6282b42 commit 96fe56a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libs/langchain-community/src/llms/layerup_security.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
LLM,
BaseLLM,
type BaseLLMParams,
type BaseLLMCallOptions,
} from "@langchain/core/language_models/llms";
import {
GuardrailResponse,
LayerupSecurity as LayerupSecuritySDK,
LLMMessage,
} from "@layerup/layerup-security";

export interface LayerupSecurityOptions extends BaseLLMParams {
export interface LayerupSecurityOptions extends BaseLLMCallOptions {
llm: BaseLLM;
layerupApiKey?: string;
layerupApiBaseUrl?: string;
Expand Down Expand Up @@ -101,7 +101,7 @@ export class LayerupSecurity extends LLM {
return "layerup_security";
}

async _call(input: string, options?: BaseLLMParams): Promise<string> {
async _call(input: string, options?: BaseLLMCallOptions): Promise<string> {
// Since LangChain LLMs only support string inputs, we will wrap each call to Layerup in a single-message
// array of messages, then extract the string element when we need to access it.
let messages: LLMMessage[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { test } from "@jest/globals";
import { LLM, type BaseLLMParams } from "@langchain/core/language_models/llms";
import {
LLM,
type BaseLLMCallOptions,
} from "@langchain/core/language_models/llms";
import { GuardrailResponse } from "@layerup/layerup-security/types.js";
import {
LayerupSecurity,
Expand All @@ -18,7 +21,7 @@ export class MockLLM extends LLM {
return "mock_llm";
}

async _call(_input: string, _options?: BaseLLMParams): Promise<string> {
async _call(_input: string, _options?: BaseLLMCallOptions): Promise<string> {
return "Hi Bob! How are you?";
}
}
Expand Down

0 comments on commit 96fe56a

Please sign in to comment.