Skip to content

Commit 840cb44

Browse files
committed
♻️ Refactor LCEL chain construction for cleaner code
1 parent 6d04d4e commit 840cb44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aicodebot/commands/commit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def commit(response_token_size, yes, skip_pre_commit, files): # noqa: PLR0915
9898
console.print("Analyzing the differences and generating a commit message")
9999
with console.status(f"Generating commit message with {lmm.model_name} via {lmm.provider}", spinner="dots"):
100100
llm = lmm.model_factory(response_token_size=response_token_size)
101-
structured_llm = llm.with_structured_output(CommitMessage)
102-
chain = prompt | structured_llm
101+
# Using Langchain Expression Language (LCEL) for structured output. So chic! 😉
102+
chain = prompt | llm.with_structured_output(CommitMessage)
103103
response = chain.invoke({"diff_context": diff_context, "languages": languages})
104104

105105
# Handle both object and dict responses,

0 commit comments

Comments
 (0)