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

experimental: add a typescript version of autogen #5677

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

rysweet
Copy link
Collaborator

@rysweet rysweet commented Feb 24, 2025

Why are these changes needed?

continuing to add support for key programming languages.

Related issue number

Closes #236

This is experimental.

Its got tests (at least the same ones the dotnet side has), samples/GettingStarted, GH actions, and docs.

It still needs packaging, and since I based it off of the dotnet then the agentchat layer is much closer to the dotnet version. I think we can use an agent to compare it to the python version. I also haven't yet tested how the docs site renders. It also doesn't have anything at all to do with AI.

A lot of this code was direct translation, but then in the process of trying to get the tests to work there were deviations, largely because I think my translation was flawed in a lot of ways.... There is certainly some garbage, and may be demons but I tried to cast them away with the tests and the sample. There also is excessive console logging, because it was easier to get the AI to reason over the tests that way. What it needs is probably more tests, code reading etc.
but its a start.

Checks

@rysweet rysweet requested a review from Copilot February 24, 2025 02:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

typescript/samples/GettingStarted/Checker.ts:9

  • [nitpick] The name 'TerminationF' and its usage via the property 'runUntilFunc' can be misleading since it returns a termination condition instead of a continuation indicator. Consider renaming them to something like 'shouldTerminate' for improved clarity.
type TerminationF = (x: number) => boolean;

@rysweet rysweet marked this pull request as draft February 24, 2025 02:23
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.75%. Comparing base (b37c192) to head (3935007).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5677      +/-   ##
==========================================
+ Coverage   69.37%   75.75%   +6.38%     
==========================================
  Files         244      171      -73     
  Lines       12610    10637    -1973     
  Branches      243        0     -243     
==========================================
- Hits         8748     8058     -690     
+ Misses       3672     2579    -1093     
+ Partials      190        0     -190     
Flag Coverage Δ
unittests 75.75% <ø> (+6.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rysweet rysweet marked this pull request as ready for review February 24, 2025 16:37
@gagb
Copy link
Collaborator

gagb commented Feb 24, 2025

D A M N!

@rysweet rysweet changed the title add a typescript version of autogen experimental: add a typescript version of autogen Feb 24, 2025
python/uv.lock Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure this pr should affect this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you are right, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please add quick start example that is consistent with python quick start example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do!

@rysweet rysweet marked this pull request as draft February 26, 2025 03:24
@@ -0,0 +1,104 @@
import { AgentMessage, ChatMessage } from './Messages';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it be kebab-case be a more conventional way of naming those files in typescript? e.g. chat-agent.ts

@lspinheiro
Copy link
Collaborator

Do we have any idea of the pros and cons of the package structure of python vs dotnet? I would expect typescript to have a really good support for package-like structure similar to python but I don't know what are the distrubition considerations here. I think it could also make some sense to start with only core and later add agentchat. The cognitive load would be way more manageable.

To create an agent, extend the `BaseAgent` class and implement `IHandle<T>`:

```typescript
import { BaseAgent } from '@microsoft/autogen-ts';
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe autogen-js? It will be compiled and distributed as javascript even if we use typescript to build

with:
node-version: '18'
- name: Install dependencies
run: npm install
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think pnpm or yarn would be more modern package managers. Both also would also better support workspaces in case we consider a similar package structure to python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript port of AutoGen
3 participants