update
This commit is contained in:
22
src/util.jl
22
src/util.jl
@@ -281,18 +281,27 @@ timeline = createTimeline(events)
|
||||
# 2) Assistant> Hi there! with a smile
|
||||
|
||||
"""
|
||||
function createTimeline(events::T1) where {T1<:AbstractVector}
|
||||
function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothing
|
||||
) where {T1<:AbstractVector}
|
||||
# Initialize empty timeline string
|
||||
timeline = ""
|
||||
|
||||
# Iterate through events with index
|
||||
for (i, event) in enumerate(events)
|
||||
# Determine which indices to use - either provided range or full length
|
||||
ind =
|
||||
if eventindex !== nothing
|
||||
[eventindex...]
|
||||
else
|
||||
1:length(events)
|
||||
end
|
||||
|
||||
# Iterate through events and format each one
|
||||
for (i, event) in zip(ind, events)
|
||||
# If no outcome exists, format without outcome
|
||||
if event[:outcome] === nothing
|
||||
timeline *= "Event_$i) $(event[:subject])> $(event[:actioninput])\n"
|
||||
# If outcome exists, include it in formatting
|
||||
timeline *= "Event_$i $(event[:subject])> $(event[:actioninput])\n"
|
||||
# If outcome exists, include it in formatting
|
||||
else
|
||||
timeline *= "Event_$i) $(event[:subject])> $(event[:actioninput]) $(event[:outcome])\n"
|
||||
timeline *= "Event_$i $(event[:subject])> $(event[:actioninput]) $(event[:outcome])\n"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -302,7 +311,6 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
# """ Convert a single chat dictionary into LLM model instruct format.
|
||||
|
||||
# # Llama 3 instruct format example
|
||||
|
||||
Reference in New Issue
Block a user