Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community[patch]: Fix types #6313

Merged
merged 1 commit into from
Aug 1, 2024
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: 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
Loading