Skip to content

Conversation

@Kanaricc
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Kanaricc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project by integrating new Langchain-based workflows. It introduces a sophisticated 'learn-to-ask' medical assistant demo, complete with reward functions for evaluating question quality, and a dedicated math agent capable of solving problems. These additions broaden the framework's capabilities in handling complex agentic tasks and demonstrate practical applications of large language models, supported by necessary dependency updates and minor code cleanup.

Highlights

  • New Langchain Demos: Introduced two new demonstration workflows utilizing the Langchain library: one for a 'learn-to-ask' medical assistant and another for a math-solving agent.
  • Dependency Update: Added langchain>=1.2.3 as a development dependency in pyproject.toml to support the new demos.
  • Compatibility Improvement: Expanded verl version compatibility in ajet/utils/launch_utils.py to include development versions (specifically '0.5.0.dev').

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Kanaricc Kanaricc requested a review from binary-husky January 11, 2026 03:25
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two new demonstration scripts utilizing langchain for a math agent and a 'learn-to-ask' agent. The changes primarily involve adding these new files and including langchain as a dependency. My review is focused on the new scripts, where I've identified opportunities for improvement. These include cleaning up unused imports, correcting a workflow name that seems to have been copied from another example, and addressing a more significant issue with the use of threading primitives in an asynchronous context. I have provided specific suggestions for these points to enhance code quality and correctness.

Comment on lines +148 to +163
_reward_semaphore = threading.Semaphore(16)

async def reward_fn_with_semaphore(*args, **kwargs):

get_sem_ok = False
while not get_sem_ok:
get_sem_ok = _reward_semaphore.acquire(blocking=False)
if not get_sem_ok:
await asyncio.sleep(1)

try:
fn_result = await reward_fn(*args, **kwargs)
finally:
_reward_semaphore.release()

return fn_result

Choose a reason for hiding this comment

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

high

The current implementation uses threading.Semaphore with a polling loop (while not get_sem_ok...) in an asyncio context. This is inefficient as it involves busy-waiting. A more idiomatic and efficient approach for asynchronous code is to use asyncio.Semaphore, which integrates with the async with statement for cleaner and non-blocking synchronization.

Suggested change
_reward_semaphore = threading.Semaphore(16)
async def reward_fn_with_semaphore(*args, **kwargs):
get_sem_ok = False
while not get_sem_ok:
get_sem_ok = _reward_semaphore.acquire(blocking=False)
if not get_sem_ok:
await asyncio.sleep(1)
try:
fn_result = await reward_fn(*args, **kwargs)
finally:
_reward_semaphore.release()
return fn_result
_reward_semaphore = asyncio.Semaphore(16)
async def reward_fn_with_semaphore(*args, **kwargs):
async with _reward_semaphore:
return await reward_fn(*args, **kwargs)

import asyncio
import threading

from agentscope.message import Msg

Choose a reason for hiding this comment

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

medium

The Msg class is imported from agentscope.message but is not used within this file. It's good practice to remove unused imports to keep the code clean and maintainable.



class ExampleLearn2Ask(Workflow):
name: str = "math_agent_workflow"

Choose a reason for hiding this comment

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

medium

The workflow name math_agent_workflow seems to be a copy-paste from another example. To improve clarity and avoid potential confusion, it should be renamed to something more descriptive of its actual function, like learn2ask_langchain_workflow.

Suggested change
name: str = "math_agent_workflow"
name: str = "learn2ask_langchain_workflow"

Comment on lines +1 to +10
from loguru import logger
from ajet import AjetTuner, Workflow, WorkflowOutput, WorkflowTask
from openai.types.chat.chat_completion import ChatCompletion
from openai.types.chat import ChatCompletionMessageToolCall
from textwrap import dedent

import json
import asyncio
import requests
from langchain.agents import create_agent

Choose a reason for hiding this comment

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

medium

This file contains several unused imports, including loguru, openai.types, json, asyncio, and requests. Removing these will improve code readability and maintainability. It's also a good practice to group and order imports according to PEP 8.

Suggested change
from loguru import logger
from ajet import AjetTuner, Workflow, WorkflowOutput, WorkflowTask
from openai.types.chat.chat_completion import ChatCompletion
from openai.types.chat import ChatCompletionMessageToolCall
from textwrap import dedent
import json
import asyncio
import requests
from langchain.agents import create_agent
from textwrap import dedent
from langchain.agents import create_agent
from ajet import AjetTuner, Workflow, WorkflowOutput, WorkflowTask

@Kanaricc Kanaricc merged commit 886d7c0 into main Jan 12, 2026
0 of 2 checks passed
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.

2 participants