Skip to content

Expose global variables in prompting templates #533

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nemoguardrails/actions/v2_x/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ async def generate_user_intent(
"examples": examples,
"potential_user_intents": ", ".join(potential_user_intents),
"user_action": user_action,
"context": state.context,
},
)
stop = self.llm_task_manager.get_stop_tokens(
Expand Down Expand Up @@ -266,6 +267,7 @@ async def check_for_active_flow_finished_match(
)
async def generate_flow_from_instructions(
self,
state: State,
instructions: str,
events: List[dict],
llm: Optional[BaseLLM] = None,
Expand Down Expand Up @@ -298,6 +300,7 @@ async def generate_flow_from_instructions(
"examples": examples,
"flow_name": flow_name,
"instructions": instructions,
"context": state.context,
},
)

Expand Down Expand Up @@ -330,6 +333,7 @@ async def generate_flow_from_instructions(
)
async def generate_flow_from_name(
self,
state: State,
name: str,
events: List[dict],
llm: Optional[BaseLLM] = None,
Expand Down Expand Up @@ -358,6 +362,7 @@ async def generate_flow_from_name(
context={
"examples": examples,
"flow_name": name,
"context": state.context,
},
)

Expand All @@ -384,6 +389,7 @@ async def generate_flow_from_name(
)
async def generate_flow_continuation(
self,
state: State,
events: List[dict],
temperature: Optional[float] = None,
llm: Optional[BaseLLM] = None,
Expand Down Expand Up @@ -421,6 +427,7 @@ async def generate_flow_continuation(
events=events,
context={
"examples": examples,
"context": state.context,
},
)

Expand Down Expand Up @@ -467,6 +474,7 @@ async def generate_flow_continuation(
@action(name="GenerateValueAction", is_system_action=True, execute_async=True)
async def generate_value(
self,
state: State,
instructions: str,
events: List[dict],
var_name: Optional[str] = None,
Expand Down Expand Up @@ -504,6 +512,7 @@ async def generate_value(
"examples": examples,
"instructions": instructions,
"var_name": var_name if var_name else "result",
"context": state.context,
},
)

Expand Down
Loading