Replies: 1 comment
-
I wrote it like that because then the struct doesn't need to be put on the heap. However, the content of this chain can be large because it contains another chain. So the extra memory usage and time used coping the object every call might outweigh the time used to put it on the heap. The performance change is likely small, but I still think that changing it might be smart to increase consistency. Some chains might want to change their state in the call function and the llm chain constructor already returns a pointer. I also belive returning pointers in new functions is more normal in Go, but I am not sure. Changing this might be a good idea. |
Beta Was this translation helpful? Give feedback.
-
Hi Folks,
I'm exploring to see if I can contribute. I see that a struct's function is implemented as a value receiver rather than a pointer receiver.
Illustration :
As I understand this will make every invocation of
Call
will copy theRetrievalQA
object.I'm not experienced in using
value pointer
in past projects, if anyone can help to understand the reasoning behind this that would be really helpful.Beta Was this translation helpful? Give feedback.
All reactions