The sources field is blank in case of passing custom prompt to RetrievalQAWithSourcesChain.from_chain_type

System Info
python: 3.11
Who can help?
No response
Information

[ ] The official example notebooks/scripts
[ ] My own modified scripts

Related Components

[ ] LLMs/Chat Models
[ ] Embedding Models
[ ] Prompts / Prompt Templates / Prompt Selectors
[ ] Output Parsers
[ ] Document Loaders
[ ] Vector Stores / Retrievers
[ ] Memory
[ ] Agents / Agent Executors
[ ] Tools / Toolkits
[ ] Chains
[ ] Callbacks/Tracing
[ ] Async

Reproduction
I am trying to get answers from documents that stored in elastic search, for this I am using the following:
PROMPT = PromptTemplate(
        template=QA_PROMPT, input_variables=["summaries", "question"]
    )
    chain_type_kwargs = {"prompt": PROMPT}
    db = ElasticVectorSearch(
            elasticsearch_url=ELASTIC_URL,
            index_name=get_project_folder_name(project_name),
            embedding=embeddings_model
        )
    qa_chain = RetrievalQAWithSourcesChain.from_chain_type(
        llm=llm,
        chain_type="stuff",
        retriever=db.as_retriever(),
        chain_type_kwargs=chain_type_kwargs,
        return_source_documents=True,
        verbose=True
        )

  answer = qa_chain({"question": question})

I noticed that sources appear in the response normally in case of not passing chain_type_kwargs=chain_type_kwargs, once I started using chain_type_kwargs=chain_type_kwargs, to apply the custom prompt I get the sources field as blank.
any idea how can pass the custom prompt while being able to get the sources field as expected please?
Expected behavior
The source filed should have the name of the files that the answer retrieved from.

🤖
Hello,
From your code, it seems like you're correctly setting the return_source_documents parameter to True when creating the RetrievalQAWithSourcesChain. This should indeed return the source documents in the response.
However, you mentioned that the sources field is blank when you pass chain_type_kwargs=chain_type_kwargs to apply a custom prompt. This might be due to the fact that the chain_type_kwargs parameter is used to provide additional arguments when loading a chain of a specific type. If the chain type you're loading doesn't support returning source documents, this could explain why the sources field is blank.
Here is the relevant code from the RetrievalQAWithSourcesChain.from_chain_type function:
@classmethod
def from_chain_type(
    cls,
    llm: BaseLanguageModel,
    chain_type: str = "stuff",
    chain_type_kwargs: Optional[dict] = None,
    **kwargs: Any,
) -> BaseQAWithSourcesChain:
    """Load chain from chain type."""
    _chain_kwargs = chain_type_kwargs or {}
    combine_documents_chain = load_qa_with_sources_chain(
        llm, chain_type=chain_type, **_chain_kwargs
    )
    return cls(combine_documents_chain=combine_documents_chain, **kwargs)

(Source: libs/langchain/langchain/chains/qa_with_sources/base.py)
As you can see, the chain_type_kwargs are passed to the load_qa_with_sources_chain function, which is responsible for loading a chain of the specified type.
If you're using a chain type that doesn't support returning source documents, you might want to try a different chain type. For example, the "refine" chain type does support returning source documents, as mentioned in this issue.
If you're already using a chain type that should support returning source documents, there might be a bug in the LangChain framework. In that case, please provide more details about the chain type you're using and any error messages you're seeing, so we can help you troubleshoot the issue.
I hope this helps! Let me know if you have any other questions.
Sources

Conversational Retrieval QA with sources cannot return source
libs/langchain/langchain/chains/qa_with_sources/base.py

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.

I already use chain_type="stuff", and this should provide the source support returning source documents correctly. I think it might be a bug.

🤖
Hello,
Thank you for reaching out and providing detailed information about your issue. I believe I understand what's happening and how to help you resolve it.
The sources field is blank in the response because the custom prompt template you are using does not include a placeholder for the sources in the FINAL ANSWER section.
In the provided template, the SOURCES part is mentioned in the instructions but there is no placeholder {} for it in the FINAL ANSWER section.
To include the sources in the final answer, you should modify the template to include a placeholder for the sources. Here is how you can do it:
template = """Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" part in your answer.

QUESTION: Which state/country's law governs the interpretation of the contract?
=========
Content: This Agreement is governed by English law and the parties submit to the exclusive jurisdiction of the English courts in  relation to any dispute (contractual or non-contractual) concerning this Agreement save that either party may apply to any court for an  injunction or other relief to protect its Intellectual Property Rights.
Source: 28-pl
Content: No Waiver. Failure or delay in exercising any right or remedy under this Agreement shall not constitute a waiver of such (or any other)  right or remedy.\n\n11.7 Severability. The invalidity, illegality or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation  in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any  kind between the parties.\n\n11.9 No Third-Party Beneficiaries.
Source: 30-pl
Content: (b) if Google believes, in good faith, that the Distributor has violated or caused Google to violate any Anti-Bribery Laws (as  defined in Clause 8.5) or that such a violation is reasonably likely to occur,
Source: 4-pl
=========
FINAL ANSWER: This Agreement is governed by English law.
SOURCES: {sources}
QUESTION: What did the president say about Michael Jackson?
=========
Content: Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.  \n\nLast year COVID-19 kept us apart. This year we are finally together again. \n\nTonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. \n\nWith a duty to one another to the American people to the Constitution. \n\nAnd with an unwavering resolve that freedom will always triumph over tyranny. \n\nSix days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. \n\nHe thought he could roll into Ukraine and the world would roll over.  Everyone from students to retirees teachers turned soldiers defending their homeland.
Source: 0-pl
Content: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. \n\nLet’s use this moment to reset. Let’s stop looking at COVID-19 as a partisan dividing line and see it for what it is: A God-awful disease.  \n\nLet’s stop seeing each other as enemies, and start seeing each other for who we really are: Fellow Americans.  \n\nWe can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together. \n\nI recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. \n\nThey were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. \n\nOfficer Mora was 27 years old. \n\nOfficer Rivera was 22. \n\nBoth Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers. \n\nI spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.
 A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reserves around the world.  \n\nAmerica will lead that effort, releasing 30 Million barrels from our own Strategic Petroleum Reserve. And we stand ready to do more if necessary, unified with our allies.  \n\nThese steps will help blunt gas prices here at home. And I know the news about what’s happening can seem alarming. \n\nBut I want you to know that we are going to be okay.
Source: 5-pl
Content: More support for patients and families. \n\nTo get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. \n\nIt’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more.  \n\nARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s, diabetes, and more. \n\nA unity agenda for the nation. \n\nWe can do this. \n\nMy fellow Americans—tonight , we have gathered in a sacred space—the citadel of our democracy. \n\nIn this Capitol, generation after generation, Americans have debated great questions amid great strife, and have done great things. \n\nWe have fought for freedom, expanded liberty, defeated totalitarianism and terror. \n\nAnd built the strongest, freest, and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.
Source: 34-pl
=========
FINAL ANSWER: The president did not mention Michael Jackson.
SOURCES: {sources}
QUESTION: {question}
=========
{summaries}
=========
FINAL ANSWER: {final_answer}
SOURCES: {sources}"""
PROMPT = PromptTemplate(template=template, input_variables=["summaries", "question", "final_answer", "sources"])

This way, the SOURCES part will be included in the final answer when you use the RetrievalQAWithSourcesChain.from_chain_type function with the return_source_documents parameter set to True.
In the context shared, the BaseQAWithSourcesChain class in the LangChain Python framework uses the _split_sources method to split the sources from the answer. If the answer does not contain a placeholder for the sources, the sources field in the response will be blank.
You can find more details in the LangChain Python framework's source code:

libs/langchain/langchain/chains/qa_with_sources/stuff_prompt.py
libs/langchain/langchain/chains/qa_with_sources/base.py

I hope this helps! If you have any other questions or need further clarification, please don't hesitate to ask.
Sources

Conversational Retrieval QA with sources cannot return source
libs/langchain/langchain/chains/qa_with_sources/stuff_prompt.py
libs/langchain/langchain/chains/qa_with_sources/base.py

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.

I added the exact template:
    "QA_PROMPT": "Given the following extracted parts of a long document and a question, create a final answer with references (\"SOURCES\").\nIf you don't know the answer, just say that you don't know. Don't try to make up an answer.\nALWAYS return a \"SOURCES\" part in your answer.\n\nQUESTION: Which state/country's law governs the interpretation of the contract?\n=========\nContent: This Agreement is governed by English law and the parties submit to the exclusive jurisdiction of the English courts in relation to any dispute (contractual or non-contractual) concerning this Agreement save that either party may apply to any court for an injunction or other relief to protect its Intellectual Property Rights.\nSource: 28-pl\nContent: No Waiver. Failure or delay in exercising any right or remedy under this Agreement shall not constitute a waiver of such (or any other) right or remedy.\n\n11.7 Severability. The invalidity, illegality or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any kind between the parties.\n\n11.9 No Third-Party Beneficiaries.\nSource: 30-pl\nContent: (b) if Google believes, in good faith, that the Distributor has violated or caused Google to violate any Anti-Bribery Laws (as defined in Clause 8.5) or that such a violation is reasonably likely to occur,\nSource: 4-pl\n=========\nFINAL ANSWER: This Agreement is governed by English law.\nSOURCES: {sources}\nQUESTION: What did the president say about Michael Jackson?\n=========\nContent: Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans. \n\nLast year COVID-19 kept us apart. This year we are finally together again. \n\nTonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. \n\nWith a duty to one another to the American people to the Constitution. \n\nAnd with an unwavering resolve that freedom will always triumph over tyranny. \n\nSix days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. \n\nHe thought he could roll into Ukraine and the world would roll over.  Everyone from students to retirees teachers turned soldiers defending their homeland.\nSource: 0-pl\nContent: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. \n\nLet’s use this moment to reset. Let’s stop looking at COVID-19 as a partisan dividing line and see it for what it is: A God-awful disease.  \n\nLet’s stop seeing each other as enemies, and start seeing each other for who we really are: Fellow Americans.  \n\nWe can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together. \n\nI recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. \n\nThey were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. \n\nOfficer Mora was 27 years old. \n\nOfficer Rivera was 22. \n\nBoth Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers. \n\nI spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.\nSource: 24-pl\nContent: And a proud Ukrainian people, who have known 30 years  of independence, have repeatedly shown that they will not tolerate anyone who tries to take their country backwards.  \n\nTo all Americans, I will be honest with you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reserves around the world.  \n\nAmerica will lead that effort, releasing 30 Million barrels from our own Strategic Petroleum Reserve. And we stand ready to do more if necessary, unified with our allies.  \n\nThese steps will help blunt gas prices here at home. And I know the news about what’s happening can seem alarming. \n\nBut I want you to know that we are going to be okay.\nSource: 5-pl\nContent: More support for patients and families. \n\nTo get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. \n\nIt’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more.  \n\nARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s, diabetes, and more. \n\nA unity agenda for the nation. \n\nWe can do this. \n\nMy fellow Americans—tonight , we have gathered in a sacred space—the citadel of our democracy. \n\nIn this Capitol, generation after generation, Americans have debated great questions amid great strife, and have done great things. \n\nWe have fought for freedom, expanded liberty, defeated totalitarianism and terror. \n\nAnd built the strongest, freest, and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.\nSource: 34-pl\n=========\nFINAL ANSWER: The president did not mention Michael Jackson.\nSOURCES: {sources}\nQUESTION: {question}\n=========\n{summaries}\n=========\nFINAL ANSWER: {final_answer}\nSOURCES: {sources}",

and created it like this
 PROMPT = PromptTemplate(
        template=QA_PROMPT, input_variables=["summaries", "question", "final_answer", "sources"]
    )
    chain_type_kwargs = {"prompt": PROMPT}
qa_chain = RetrievalQAWithSourcesChain.from_chain_type(
        llm=llm,
        chain_type="stuff",
        retriever=db.as_retriever(),
        chain_type_kwargs=chain_type_kwargs,
        return_source_documents=True,
        verbose=True
        )

but I get the following error:
ValueError: Missing some input keys: {'final_answer', 'sources'}

how is this while I passed them in the creation of it?
also is it a must to include all these questions in the template?

🤖
Hello,
Thank you for reaching out and providing a detailed explanation of your issue.
To include the sources in the final answer, you need to modify your custom prompt template to include a placeholder for the sources. Here's how you can do it:
template = """Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" part in your answer.

QUESTION: {question}
=========
{summaries}
=========
FINAL ANSWER: {final_answer}
SOURCES: {sources}"""  # Add this line
PROMPT = PromptTemplate(template=template, input_variables=["summaries", "question", "final_answer", "sources"])  # Add "sources" here

Please note that you need to ensure that the sources variable is being passed correctly when these templates are being used. The sources variable is defined in the BaseQAWithSourcesChain class in the base.py file in the langchain/chains/qa_with_sources directory. The sources variable is used in the _split_sources method to split the sources from the answer.
I hope this helps! If you have any other questions, feel free to ask.
Best, Dosu
Sources

libs/langchain/langchain/chains/qa_with_sources/refine_prompts.py
libs/langchain/langchain/chains/qa_with_sources/stuff_prompt.py
libs/langchain/langchain/chains/qa_with_sources/map_reduce_prompt.py
libs/langchain/langchain/chains/qa_with_sources/base.py

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.

not helpful, I already added them in my previous comment in both the template and in PromptTemplate, and i got the same error:
ValueError: Missing some input keys: {'final_answer', 'sources'}

how to ensure that sources is passed correctly to RetrievalQAWithSourcesChain.from_chain_type

I already added sources in my custom prompt, and my documents include the source in the metadata. however, i still get the sources field blank.
I don't use chroma as retrieval instead I use,
db = ElasticVectorSearch(
            elasticsearch_url=get_elastic_URL(),
            index_name=index_name,
            embedding=embeddings
        )

again even though I passed the correct template that includes sources, I got the following error:
ValueError: Missing some input keys: {'final_answer', 'sources'}

may not help but have you tried using ElasticsearchStore instead? Its the recommended way to use Elasticsearch with langchain and the issue you're having could be an issue with the ElasticVectorSearch.
ElasticsearchStore supports metadata which im unsure about ElasticVectorSearch, so this could be the issue.

It split when parsing with the word issue.

`def get_retrieval_prompt():
COMBINE_PROMPT = """Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" part in your answer.
QUESTION: Which state/country's law governs the interpretation of the contract?
Content: This Agreement is governed by English law and the parties submit to the exclusive jurisdiction of the English courts in  relation to any dispute (contractual or non-contractual) concerning this Agreement save that either party may apply to any court for an  injunction or other relief to protect its Intellectual Property Rights.
Reference: 28-pl
Content: No Waiver. Failure or delay in exercising any right or remedy under this Agreement shall not constitute a waiver of such (or any other)  right or remedy.\n\n11.7 Severability. The invalidity, illegality or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation  in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any  kind between the parties.\n\n11.9 No Third-Party Beneficiaries.
Reference: 30-pl
Content: (b) if Google believes, in good faith, that the Distributor has violated or caused Google to violate any Anti-Bribery Laws (as  defined in Clause 8.5) or that such a violation is reasonably likely to occur,
Reference: 4-pl
FINAL ANSWER: This Agreement is governed by English law.
SOURCES: 28-pl
QUESTION: What did the president say about Michael Jackson?
Content: Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.  \n\nLast year COVID-19 kept us apart. This year we are finally together again. \n\nTonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. \n\nWith a duty to one another to the American people to the Constitution. \n\nAnd with an unwavering resolve that freedom will always triumph over tyranny. \n\nSix days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. \n\nHe thought he could roll into Ukraine and the world would roll over.  Everyone from students to retirees teachers turned soldiers defending their homeland.
Reference: 0-pl
Content: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. \n\nLet’s use this moment to reset. Let’s stop looking at COVID-19 as a partisan dividing line and see it for what it is: A God-awful disease.  \n\nLet’s stop seeing each other as enemies, and start seeing each other for who we really are: Fellow Americans.  \n\nWe can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together. \n\nI recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. \n\nThey were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. \n\nOfficer Mora was 27 years old. \n\nOfficer Rivera was 22. \n\nBoth Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers. \n\nI spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.
 A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions  is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reserves around the world.  \n\nAmerica will lead that effort, releasing 30 Million barrels from our own Strategic Petroleum Reserve. And we stand ready to do more if necessary, unified with our allies.  \n\nThese steps will help blunt gas prices here at home. And I know the news about what’s happening can seem alarming. \n\nBut I want you to know that we are going to be okay.
Reference: 5-pl
Content: More support for patients and families. \n\nTo get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. \n\nIt’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more.  \n\nARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s, diabetes, and more. \n\nA unity agenda for the nation. \n\nWe can do this. \n\nMy fellow Americans—tonight , we have gathered in a sacred space—the citadel of our democracy. \n\nIn this Capitol, generation after generation, Americans have debated great questions amid great strife, and have done great things. \n\nWe have fought for freedom, expanded liberty, defeated totalitarianism and terror. \n\nAnd built the strongest, freest, and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.
Reference: 34-pl
FINAL ANSWER: The president did not mention Michael Jackson.
SOURCES:
QUESTION: {question}
{summaries}
FINAL ANSWER:"""
combine_prompt_template = PromptTemplate(
template=COMBINE_PROMPT, input_variables=["summaries", "question"]
)
document_prompt_template = PromptTemplate(
    template="Content: {page_content}\nSource: {source}",
    input_variables=["page_content", "source"],
)

return combine_prompt_template, document_prompt_template`

and

`    combine_prompt_template, document_prompt_template = get_retrieval_prompt()

retriever_qna_chain = RetrievalQAWithSourcesChain.from_chain_type(
    llm=llm,
    chain_type="stuff",
    retriever=retriever,
    return_source_documents=True,
    chain_type_kwargs={"document_prompt": document_prompt_template, "prompt": combine_prompt_template},
)`

solves the issue

I solved it with this small modification. This way, all the text after the 'SOURCES' field is taken into consideration, not just the first line.
def _split_sources(self, answer: str) -> Tuple[str, str]:
    """Split sources from answer."""
    if re.search(r"SOURCES?:", answer, re.IGNORECASE):
        answer, sources = re.split(
            r"SOURCES?:|QUESTION:\s", answer, flags=re.IGNORECASE
        )[:2]
        sources = " ".join(re.split(r"\n", sources))
    else:
        sources = ""
    return answer, sources

@dosubot I am using this
chain = load_qa_with_sources_chain(self.chat_engine,
chain_type="stuff",
prompt=QA_PROMPT,
return_source_documents=False,
callbacks=[StreamingStdOutCallbackHandler()])
How to ensure that it stream the response. Actualy it's does not.

Hi, @Mennaaah
I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, the issue you opened regarding the sources field being blank when passing a custom prompt to RetrievalQAWithSourcesChain.from_chain_type has been resolved. I provided guidance on modifying the custom prompt template to include a placeholder for the sources, and ultimately, "datorresb" and "argocan" provided a solution by modifying the _split_sources method to consider all text after the 'SOURCES' field.
Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to LangChain!

@dosubot I am using this
chain = load_qa_with_sources_chain(self.chat_engine,
chain_type="stuff",
prompt=QA_PROMPT,
return_source_documents=False,
callbacks=[StreamingStdOutCallbackHandler()])
How to ensure that it stream the response. Actualy it's does not.


Bug - JPB and job poster Work Style option doesn't match

Description
Telework:
"Almost never" on JPB becomes "Never" on job poster
Flexible hours:
"Almost never" on JPB becomes "Never" on job poster
"Sometimes" on JPB becomes "Occasionally" on job poster
"Occasionally" on JPB becomes "Sometimes" on job poster
Order of the options is different between Telework and Flexible hours
Steps to Reproduce
Steps to reproduce the behavior. Example:

Go to "Job Details" on JPB
Click on 'Occasionally' under Flexible hours
Click 'Save and preview'
Compare it with the job poster preview link (applicant version)

Images
Place image attachments here.

[ ] Regression test written.

@tristan-orourke i wanted to flag this issue as time sensitive, as it affects a poster we'd like to post tomorrow (Sep 26).

The frequency labels used in multiple places (twig and react) should come out of the database to be consistent.

Quick fix please


Dynamically changing rowSpan

I have a problem when trying to update my table. This is how my initial table looks like:

So the rowspan here works fine. My "Row" table cell looks like this:

Row

So I'm looking for the length of ordinates array for axis Y and that is the number of rows which I want my "Row" cell to cover.
Then on "Add new Y ordinate" click this is fired:
$scope.addNewYOrdinate = function() {
            $scope.tableFoo.axisY.ordinates.push({
                id: 12348,
                label: "Ordinate Y 4"
            });
};

The ract table re-renders because the props has changed and this is what I get in result:

So for some reason, although the rowspan changes to 4 and I can see that when inspecting elements, the actual rowspan still remains 3. Why is that? Is it a bug?

@RudmanMario that does seems strange. Because rowspan is updated in the DOM makes me think that this isn't a ngReact issue though.
Do you see the same problem in other browsers ?
Have you tried using your component without of angular and ngReact and does it act the same way ?

I've checked the other browsers and it looks the same there. Rowspan is updated but it doesn't span four rows.
I haven't tried using the component just in React but I guess I should, if you think it has nothing to do with ngReact. I'll see what how will behave and let you know.

It looks like it is a React problem. I made a fiddle so you can check it yourself. Really strange behavior if I'm not making some mistake in my code.

It officially is a React problem. I needed to include
 in my
. It was that simple, but strange problem nonetheless. In the next React release there will be a warning about including
 tags in
.

@RudmanMario cool thanks for the update. I'll close this issue then :smile:


Can't use the library

when i added the library to the project its gives me error about - NSString not found and also for NSObject also , etc..
i found out the the foundation library was missing and i've added it but yet it doesn't solve my problem...

https://github.com/m1entus/MZFormSheetController/issues/131

i've added import  (for uikit ) in any file of the library and also import foundation at the problematic file


ENS support

Hi! Can PopuraDNS support resolution of ENS (Ethereum Name System) domains?
ENS doesn't officially support A or AAAA records but perhaps records of text type could be used instead.

Sure, it can.
I've experimented with ens coredns plugin before. It'd be nice to add, however, it pulls in a huge go-ethereum dependency and requires CGO enabling. Not cool.
Since not everybody would need that, maybe, ENS support could be added to a side branch. Or, add it to the master branch and add a "light" branch without the ENS plugin.
I'll think about it!

Does it literally pull go-ethereum? :open_mouth:
The plugin description says it can be configured to connect to remote JSON-RPC endpoint as well. (This is not ideal, but could be acceptable in some situations.)


onItemInserting fires after submitting

I'm trying to dynamically show a column only for the insert row template called comments. When I place this in onItemInserting, it only shows after I click the insert button + on the row, and then it goes away after it's inserted. I'm trying to have this column be shown on the insert row when I display the insert row. How can I have this column be shown when I actually click the big + when showing the insert row?
    onItemInserting: function (args) { // this doesn't get fired when the insert row is shown
        edit = false;
        $('#mrcGrid').jsGrid('fieldOption', 'Comments', 'visible', 'true');
    },
    onItemInserted: function(args) {
        $('#mrcGrid').jsGrid('fieldOption', 'Comments', 'visible', false);
    },

Then you can put this in onOptionChanged callback http://js-grid.com/docs/#onoptionchanged.
Show this field when inserting option is set to true and hide otherwise.