This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
00:38 deoac left 01:15 thowe left, thowe joined 06:11 jgaz left 06:13 jgaz joined 07:41 Manifest0 joined 08:06 dakkar joined 08:21 tea3po left, tea3po joined 10:45 guifa left 14:56 SmokeMachine left 14:57 mjgardner left, tbrowder__ left 14:59 mjgardner joined, tbrowder__ joined, SmokeMachine joined
rcmlz Hello Anton, I started using it. There is an issue with people that do not have enough "quota" - will put some money up. The error message is fine, however, for people new to Raku the "Use of uninitialized value element of type Any in string context. ... " is scary. error => {code => insufficient_quota, message => You exceeded your current quota, please check your plan and billing details., param => (Any), 15:49
type => insufficient_quota} Use of uninitialized value element of type Any in string context. Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful. in method eval at /usr/local/Cellar/rakudo-star/2023.08/share/perl6/site/sources/2CBCBF8A4A1670092BE1E1523080764269775230 (LLM::Functions::Chat) line 80 in method eval at
/usr/local/Cellar/rakudo-star/2023.08/share/perl6/site/sources/2CBCBF8A4A1670092BE1E1523080764269775230 (LLM::Functions::Chat) line 56 in block <unit> at <unknown file> line 1 in method eval at /usr/local/Cellar/rakudo-star/2023.08/share/perl6/site/sources/C24820763DE9E6A4B431D7F0A8945616880E1EA8 (Jupyter::Kernel::Sandbox) line 139 in code at
/usr/local/Cellar/rakudo-star/2023.08/share/perl6/site/sources/DA76AEE5D68CD02B4E42BCB2570746B82B483811 (Jupyter::Kernel) line 147
I will record issues in github 15:50
antononcube @rcmlz Thanks a lot! At this point I am really not sure what is the best way to handle these kind errors. This gets more complicated because different LLMs handle these kind of errors differently. 15:55
rcmlz PS: how far do I get for 10$? 15:57
antononcube Hmm... Which LLM service you are using? I assume one of of OpenAIs : but which one? (The "regular", or the "ChatGPT plus".) 15:59
Another remark on error handling: PaLM often produces moderation errors. It is a problem with PaLM (which I have reported), but also it is better if there as uniform way of handling moderation errors that is also adopted by the different concrete packages for LLM access. 16:01
@rcmlz My bills with OpenAI's regular service rarely exceed $10 per month. I also I have "Plus" which is with a flat rate of $20 per month. (If it is not clear, one pays for these services separately.) 16:06
16:45 dakkar left
Tirifto_ Hello again! Just a thought that crossed my mind: Suppose I have a large string in which I’d like to make several substitutions. The substrings I wish to substitue might (or might not) have something in common, e.g. they might all start with the same character. Should I do well to perform several substitutions on that string in order, or is there a more efficient, but comparably simple way, where Raku could perform all of the substitution 17:44
s ‘in one fell swoop’, so to speak?
I imagine a custom procedure could be written (and perhaps generalised), but I wonder if there is some straightforward method or ‘good practice’ for this kind of thing. cx 17:47
gfldex Tirifto_: You can use .subst with a Callable to that. But that requires a matcher that can match all needles in one go. 18:21
librasteve Tirifto_: my approach would be to do them sequentially… with normal sized strings this should fit in RAM so I don’t see much performance gain for parallelism and I do see confusion such as what if an early subst contains a later match 18:25
gfldex Or .rindex with a list of needles and .substr if you want to make changes in place. You have to work from the end of the string because substitions may otherwise shift indices.
No wait, that is .indices nowadays. 18:27
Depending on what you want to do, breaking the Str up into a List of Str might be simpler and faster. 18:28
librasteve gfldex: does rindex mean reverse index? 18:34
gfldex yes 18:35
But it doesn't take a list of needles.
librasteve aha - tx! 18:36
ps. i also would consider “sharding” a very large Str (works of Shakespeare ish) … but dealing with boundaries is then a headache. 18:37
Tirifto_ Thank you for the advice, gfldex, @librasteve. I suppose writing a Callable would be fairly straightforward and universal, and so applicable to my use case. But I suppose I’ll only experiment with that if performance turns out to be a problem, which I suppose it won’t. xP 18:46
gfldex m: my $s = ‘this is a string.’; my %replace = i => 1, r => 2; say join ‘’, gather for $s.split(<i r>, :p) -> $p { $p ~~ Pair ?? take %replace{$p.value} !! take $p } 18:54
camelia th1s 1s a st21ng.
gfldex This is the most flexible because you can use loop-control to bail early, return Empty and such. 18:55
Also, this shows that gradual typing is just better. :-> 18:56
20:21 tea3po left, tea3po joined 20:23 teatwo joined 20:26 tea3po left