Skip to content

Commit

Permalink
refinements for twitter langchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Gerber authored and stat committed Dec 5, 2024
1 parent 95ad4c8 commit d92d97b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions twitter-langchain/src/actions/account_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ A failure response will return a message with a Twitter API request error:
/**
* Input argument schema for the account details action.
*/
export const AccountDetailsInput = z.object({}).strip().describe("Input schema for retrieving account details");
export const AccountDetailsInput = z
.object({})
.strip()
.describe("Input schema for retrieving account details");

/**
* Get the authenticated Twitter (X) user account details.
Expand All @@ -47,7 +50,7 @@ export async function accountDetails(
}

/**
* AccountDetailsAction
* Account Details Action
*/
export class AccountDetailsAction implements TwitterAction<typeof AccountDetailsInput> {
public name = "account_details";
Expand Down
6 changes: 3 additions & 3 deletions twitter-langchain/src/tests/user_mentions_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { userMentions, UserMentionsInput } from "../actions/user_mentions";
import { TwitterApi, TwitterApiv2 } from "twitter-api-v2";

const MOCK_USER_ID = "1857479287504584856"
const MOCK_USER_ID = "1857479287504584856";

describe("User Mentions Input", () => {
it("should successfully parse valid input", () => {
Expand Down Expand Up @@ -55,10 +55,10 @@ describe("User Mentions Action", () => {
});

it("should successfully retrieve user mentions", async () => {
const args = { userId: "1857479287504584856" };
const args = { userId: MOCK_USER_ID };
const response = await userMentions(mockApi, args);

expect(mockClient.userMentionTimeline).toHaveBeenCalledWith(MOCK_USER_ID);
expect(mockApi.v2.userMentionTimeline).toHaveBeenCalledWith(MOCK_USER_ID);
expect(response).toContain("Successfully retrieved user mentions:");
expect(response).toContain(JSON.stringify(mockApiResponse));
});
Expand Down

0 comments on commit d92d97b

Please sign in to comment.