-
Notifications
You must be signed in to change notification settings - Fork 319
Added 6 typescript snippets for LlmAgent #673
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
base: main
Are you sure you want to change the base?
Added 6 typescript snippets for LlmAgent #673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, added a few comments. We should also ask the SWE to give the final approval.
"@types/node": "^24.3.1", | ||
"typescript": "^5.9.2" | ||
}, | ||
"@google/adk": "file:../adk-js/core", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this line before committing (after the release of the agent).
@@ -0,0 +1,12 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best practice is to place package.json and tsconfig.json files at the root of the repository (same level as the examples
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is definitely true in general, but we will probably have many examples, each with different set of config files. I see a similar practice in the python folder where each example has its own requirements.txt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I will do the same then.
const USER_ID = "test_user_789"; | ||
const SESSION_ID_TOOL_AGENT = "session_tool_agent_ts"; | ||
const SESSION_ID_SCHEMA_AGENT = "session_schema_agent_ts"; | ||
const MODEL_NAME = "gemini-2.0-flash"; // Using flash for speed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5 model ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used gemini-2.0-flash
to maintain consistency with the python snippets, but I am okay to update the version. What do you think? Should we keep things consistent with the python examples, or do our own thing and use the more updated model?
```typescript | ||
// Example: Adding instructions | ||
const capitalAgent = new LlmAgent({ | ||
model: 'gemini-2.0-flash', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5 model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
```typescript | ||
// Example: Defining the basic identity | ||
const capitalAgent = new LlmAgent({ | ||
model: 'gemini-2.0-flash', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5 model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
"name": "adk-docs-examples", | ||
"version": "1.0.0", | ||
"description": "TS code examples for the ADK Documentation", | ||
"main": "index.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no index.js file that serves as a central export. So, this field is misleading and should be removed.
@@ -0,0 +1,12 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I will do the same then.
@@ -0,0 +1,24 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best practice is to add the package-lock.json file as well.
@@ -0,0 +1,24 @@ | |||
{ | |||
"name": "adk-docs-examples", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets rename it to "adk-llm_agent-ts-example" since we now agreed to add package.json per feature directory
{ | ||
"name": "adk-docs-examples", | ||
"version": "1.0.0", | ||
"description": "TS code examples for the ADK Documentation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same reason above, lets change the description to ADK TS example for LLM agent.
No description provided.