Find answers from the community

r
rohoon
Offline, last seen 2 days ago
Joined September 25, 2024
Hi all, I'm using CitationQueryEngine to provide citations in my responses. On my UI, I want to be able to hover over a citation (e.g. [2]) and display links to the relevant part of each source.

Using response.source_nodes, what is the best way to know which source belongs to which citation? The text field contains the citation number (e.g. "Source 2: blah blah"), but I would have to parse this to extract the citation number.

I can't see any other field that just has the citation number itself. Is there one?
7 comments
r
L
Hi, I'm having trouble getting a nested workflow working properly with event streaming. The workflow runs fine, but the event streaming is behaving strangely.

The workflow I'm testing is a variation on the Joke example from the documentation. I have a MainWorkflow that checks if the context has a topic field. If it's missing, it runs a TopicWorkflow. If it's present, it runs a JokeWorkflow.

The first time I run the workflow without a topic field, all the events work fine. When I set the topic field and run the workflow again, I somehow get a duplicate result event from the first run, then no further events.

I'll paste my code in a thread. I'd really appreciate some help!
21 comments
L
a
r
r
rohoon
·

Hitl

Hi all, I've been looking at the human-in-the-loop workflow example and trying to figure out how to make this work in a web-based chat interface. That is, instead of using input() to get user input, the input comes from a websocket connection from a frontend web app.

The approach I'm taking at the moment is to have a nested workflow as suggested in the documentation, where the main workflow directs the user input to a sub-workflow depending on the query and existing context state.

Is this a viable approach or is there some other obvious way to yield control back to the user? I'm having some trouble getting the streaming to behave properly (see my question in #❓py-issues-and-help), but want to make sure I'm on the right track before spending too much more time trying to debug it.
12 comments
r
L
l