-
-
Save jaeyson/7060121317c97fbb0a5520fa43a35d9c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
action :analyze_sentiment, :atom do | |
constraints one_of: [:positive, :negative] | |
description """ | |
Analyzes the sentiment of a given piece of text to determine if it is overall positive or negative. | |
""" | |
argument :text, :string do | |
allow_nil? false | |
description "The text for analysis" | |
end | |
run prompt( | |
LangChain.ChatModels.ChatOpenAI.new!(%{ model: "gpt-4o"}), | |
# setting `tools: true` allows it to use all exposed tools in your app | |
tools: true | |
# alternatively you can restrict it to only a set of tools | |
# tools: [:list, :of, :tool, :names] | |
# provide an optional prompt, which is an EEx template | |
# prompt: "Analyze the sentiment of the following text: <%= @input.arguments.description %>", | |
# adapter: {Adapter, [some: :opt]} | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment