-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exercise Chat
: Implement native function calling agent (#154)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2cffe1c
commit d7f5bf0
Showing
36 changed files
with
1,550 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
from app.common.singleton import Singleton | ||
from app.common.message_converters import ( | ||
convert_iris_message_to_langchain_message, | ||
convert_langchain_message_to_iris_message, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
app/domain/chat/course_chat/course_chat_pipeline_execution_dto.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
from typing import Optional | ||
from typing import Optional, Any | ||
|
||
from pydantic import Field | ||
|
||
from ..chat_pipeline_execution_dto import ChatPipelineExecutionDTO | ||
from ...data.extended_course_dto import ExtendedCourseDTO | ||
from ...data.metrics.competency_jol_dto import CompetencyJolDTO | ||
from ...data.metrics.student_metrics_dto import StudentMetricsDTO | ||
from ...event.pyris_event_dto import PyrisEventDTO | ||
|
||
|
||
class CourseChatPipelineExecutionDTO(ChatPipelineExecutionDTO): | ||
course: ExtendedCourseDTO | ||
metrics: Optional[StudentMetricsDTO] | ||
competency_jol: Optional[CompetencyJolDTO] = Field(None, alias="competencyJol") | ||
event_payload: Optional[PyrisEventDTO[Any]] = Field(None, alias="eventPayload") |
6 changes: 5 additions & 1 deletion
6
app/domain/chat/exercise_chat/exercise_chat_pipeline_execution_dto.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
from typing import Optional | ||
from typing import Optional, Any | ||
|
||
from pydantic import Field | ||
|
||
from app.domain.chat.chat_pipeline_execution_dto import ChatPipelineExecutionDTO | ||
from app.domain.data.course_dto import CourseDTO | ||
from app.domain.data.programming_exercise_dto import ProgrammingExerciseDTO | ||
from app.domain.data.programming_submission_dto import ProgrammingSubmissionDTO | ||
from app.domain.event.pyris_event_dto import PyrisEventDTO | ||
|
||
|
||
class ExerciseChatPipelineExecutionDTO(ChatPipelineExecutionDTO): | ||
submission: Optional[ProgrammingSubmissionDTO] = None | ||
exercise: ProgrammingExerciseDTO | ||
course: CourseDTO | ||
event_payload: Optional[PyrisEventDTO[Any]] = Field(None, alias="eventPayload") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
from typing import Union | ||
|
||
from .tool_message_content_dto import ToolMessageContentDTO | ||
from ...domain.data.image_message_content_dto import ImageMessageContentDTO | ||
from ...domain.data.json_message_content_dto import JsonMessageContentDTO | ||
from ...domain.data.text_message_content_dto import TextMessageContentDTO | ||
|
||
MessageContentDTO = Union[ | ||
TextMessageContentDTO, ImageMessageContentDTO, JsonMessageContentDTO | ||
TextMessageContentDTO, | ||
ImageMessageContentDTO, | ||
JsonMessageContentDTO, | ||
ToolMessageContentDTO, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Literal, Any | ||
|
||
from pydantic import BaseModel, ConfigDict, Field, Json | ||
|
||
|
||
class FunctionDTO(BaseModel): | ||
name: str = Field(..., alias="name") | ||
arguments: Json[Any] = Field(..., alias="arguments") | ||
|
||
|
||
class ToolCallDTO(BaseModel): | ||
|
||
model_config = ConfigDict(populate_by_name=True) | ||
id: str = Field(alias="id") | ||
type: Literal["function"] = "function" | ||
function: FunctionDTO = Field(alias="function") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, ConfigDict, Field | ||
|
||
|
||
class ToolMessageContentDTO(BaseModel): | ||
|
||
model_config = ConfigDict(populate_by_name=True) | ||
name: Optional[str] = Field(alias="toolName", default="") | ||
tool_content: str = Field(alias="toolContent") | ||
tool_call_id: str = Field(alias="toolCallId") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from typing import TypeVar, Generic, Optional | ||
|
||
from pydantic import Field, BaseModel | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
class PyrisEventDTO(BaseModel, Generic[T]): | ||
event_type: Optional[str] = Field(default=None, alias="eventType") | ||
event: Optional[T] = Field(default=None, alias="event") |
Oops, something went wrong.