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

feat: airtable query tool #10

Merged
merged 11 commits into from
Oct 11, 2024
Merged

feat: airtable query tool #10

merged 11 commits into from
Oct 11, 2024

Conversation

jpwsutton
Copy link
Contributor

Which issue(s) does this pull-request address?

Closes: N/A - New feature

Description

This PR introduces a new tool that allows the agent to query an Airtable base. It exposes two actions to the agent that it can execute:

  • GET_SCHEMA - Returns a JSON schema of the Airtable base listing tables, their fields and types.
  • QUERY_TABLE - Allows the agent to query an Airtable table using a formula filter and a field filter. Records are returned in JSON.

Checklist

  • I have read the contributor guide
  • Linting passes: yarn lint or yarn lint:fix
  • Formatting is applied: yarn format or yarn format:fix
  • Unit tests pass: yarn test:unit
  • E2E tests pass: yarn test:e2e
  • Tests are included
  • Documentation is changed or added
  • Commit messages and PR title follow conventional commits

Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Copy link
Contributor

@Tomas2D Tomas2D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few simplification. Overall, great job 🚀

src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
examples/agents/allToolsAgent.ts Outdated Show resolved Hide resolved
examples/agents/allToolsAgent.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Show resolved Hide resolved
src/tools/airtable.ts Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Outdated Show resolved Hide resolved
src/tools/airtable.ts Show resolved Hide resolved
@grahamwhiteuk
Copy link
Collaborator

Weird how @Tomas2D and I seemed to be reviewing at the same time. If there is a clash between our feedback, please prefer the comment from @Tomas2D over my own.

jpwsutton and others added 6 commits October 7, 2024 14:37
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
grahamwhiteuk
grahamwhiteuk previously approved these changes Oct 10, 2024
@grahamwhiteuk grahamwhiteuk requested a review from Tomas2D October 10, 2024 12:57
Signed-off-by: Graham White <gwhite@uk.ibm.com>
Comment on lines +55 to +70
const llm =
process.env.GENAI_API_KEY !== undefined
? BAMChatLLM.fromPreset("meta-llama/llama-3-1-70b-instruct")
: process.env.WATSONX_API_KEY !== undefined && process.env.WATSONX_PROJECT_ID !== undefined
? WatsonXChatLLM.fromPreset("meta-llama/llama-3-1-70b-instruct", {
apiKey: process.env.WATSONX_API_KEY, //pragma: allowlist secret
projectId: process.env.WATSONX_PROJECT_ID,
parameters: {
decoding_method: "greedy",
min_new_tokens: 5,
max_new_tokens: 50,
},
})
: process.env.OPENAI_API_KEY !== undefined
? new OpenAIChatLLM()
: new OllamaChatLLM({ modelId: "llama3.1" });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a factory function.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was a bit of a quick-and-dirty hack! Ternaries are bad enough but nested ternaries make for horrible reading, hence the comment above the code.

@grahamwhiteuk grahamwhiteuk merged commit c473aad into main Oct 11, 2024
4 checks passed
@grahamwhiteuk grahamwhiteuk deleted the feat/airtable-tool branch October 11, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants