Skip to content

Is there a recommended way of parsing the content of messages? #12

Closed Answered by crmne
diegoquiroz asked this question in Q&A
Discussion options

You must be logged in to vote

Looking at your examples, I think you're running into an issue because you're using the library in a way that wasn't intended.

The ask() method is designed to take a string as its first positional argument, not a set of named parameters. The API is meant to be used like this:

# Correct usage:
chat.ask("Hello there!")

# With additional parameters:
chat.ask("What's in this image?", with: { image: "path/to/image.jpg" })

When you do:

chat.ask(message: "Hello there!")

You're actually passing a Ruby hash as the first argument, which gets converted to a string representation and stored directly. That's why you're seeing Ruby hash syntax in your content field.

The only reason this doesn't raise …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@diegoquiroz
Comment options

@diegoquiroz
Comment options

@crmne
Comment options

Answer selected by crmne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants