Sha256: e91f5b4c36318427673cb5086eab31b83efe08d75e2434271e358ea11e89f088
Contents?: true
Size: 895 Bytes
Versions: 1
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true # This class represents an action that interacts with a given model using a # provided prompt. The action expects both a prompt and a model as input, and # returns a response generated by the model. # # Example usage: # response = Actions::InteractWithModel.execute(prompt: "What is the capital of France?", model: my_model) require "roseflow/action" class Actions::InteractWithModel # Make it a Roseflow action extend Roseflow::Action # Define the inputs and outputs of the action expects :prompt # Input: The prompt to use expects :model # Input: The model to interact with promises :response # Output: The response generated by the model executed do |ctx| # Interact with the model using the provided prompt chat = ctx.model.chat(ctx.prompt) # Store the response in the context context[:response] = chat.response end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roseflow-0.1.0 | examples/github-repo-chat/lib/actions/interact_with_model.rb |