-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing OpenAI GPT-4 with Ollama as LLM-as-a-Judge and API Calls with Local LLMs in Giskard (RAGET Toolkit) AND Replacing API Calls with Local LLMs in Giskard Using Ollama #2096
Comments
Hi Team, It’s been 5 days since I raised the issue regarding, and I wanted to follow up to kindly ask if there are any updates on this matter. This issue is quite important for us as we are looking to implement this code in our production environment. Any guidance or update would be greatly appreciated. |
Hey @pds13193, Yes, once you set From the code you shared, there is no additional configuration required. Maybe if you use Jupyter notebook you will also have to run:
|
Hey @pds13193 @henchaves I have been following exactly the same approach that @pds13193 is following and I keep getting this error
@pds13193 did you face this problem? |
No I did not get this error
…On Fri, 31 Jan, 2025, 3:58 pm omarelgaml, ***@***.***> wrote:
Hey @pds13193 <https://github.com/pds13193> @henchaves
<https://github.com/henchaves>
I have been following exactly the same approach that @pds13193
<https://github.com/pds13193> is following and I keep getting this error
2025-01-31 21:51:12,249 pid:85464 MainThread giskard.rag INFO Finding
topics in the knowledge base. 2025-01-31 21:52:16,689 pid:85464 MainThread
giskard.rag INFO Found 3 topics in the knowledge base. Generating
questions: 0%| | 0/5 [00:00<?, ?it/s] 2025-01-31 21:54:37,782 pid:85464
MainThread giskard.rag ERROR Encountered error in question generation:
'question'. Skipping. 2025-01-31 21:54:37,847 pid:85464 MainThread
giskard.rag ERROR 'question' Traceback (most recent call last): File
"/Users/omar/myenv/lib/python3.10/site-packages/giskard/rag/question_generators/base.py",
line 59, in generate_questions yield
self.generate_single_question(knowledge_base, *args, **kwargs,
seed_document=doc) File
"/Users/omar/myenv/lib/python3.10/site-packages/giskard/rag/question_generators/simple_questions.py",
line 108, in generate_single_question question=generated_qa["question"],
KeyError: 'question'
@pds13193 <https://github.com/pds13193> did you face this problem?
—
Reply to this email directly, view it on GitHub
<#2096 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDDSHWPQ62KSJDNK4NFKPR32NPPV7AVCNFSM6AAAAABU5Y5DMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRYGM4DMMRWGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey @henchaves, do you have any idea why is that happening? |
Hi @omarelgaml, |
Hi @henchaves, Thank you for getting back to me. I did exactly like the documentation. Here is my code:api_base = "http://localhost:11434" # default api_base for local Ollama
giskard.llm.set_llm_model("ollama/llama3.1", disable_structured_output=True, api_base=api_base)
giskard.llm.set_embedding_model("ollama/nomic-embed-text", api_base=api_base)
csv_files = [".."]
all_documents = []
for file_name in os.listdir('./data'):
if file_name.endswith('.csv'):
file_path = os.path.join('./data', file_name)
loader = CSVLoader(file_path)
documents = loader.load()
all_documents.extend(documents)
text_splitter = RecursiveCharacterTextSplitter(
chunk_size=1024, chunk_overlap=20, add_start_index=True
)
all_splits = text_splitter.split_documents(all_documents)
df = pd.DataFrame([d.page_content for d in all_splits], columns=["text"])
knowledge_base = KnowledgeBase(df[0:20])
testset = generate_testset(
knowledge_base,
num_questions=10,
language="de",
agent_description="make testset relevant to the provided data."
) Issues:
It only generated 60% of the questions. If I request 50 questions, it generates fewer than 50% of them.
from giskard.rag import evaluate
from rag_chain import langchain_create_retrieval_chain_init
chain = langchain_create_retrieval_chain_init()
def get_answer_fn(question: str, history=None) -> str:
"""A function representing your RAG agent."""
answer = chain.invoke(question) # could be langchain, llama_index, etc.
return answer
report = evaluate(get_answer_fn, testset=testset, knowledge_base=knowledge_base)
report.to_html("rag_eval_report.html") Error:
Could you please check these issues? Thank you! |
Hey @omarelgaml, I see that you are using |
Hey @henchaves , Yes the But I still get the same problem when I try to print the report, and when I use |
Hello @omarelgaml. I'm really sorry for the late response. Let me try to help you with that. First thing that may be compromising the final report object, is the response format from your call to Secondly, regarding the retriever score, if you want to have the scores for each RAG component, it's more appropriated to call On my side, I've tried to reproduce the same steps as you did, but I successfully managed to call |
Checklist
issues
.❓ Question
I am currently using Giskard, specifically the RAGET toolkit, for evaluating our chatbot. By default, Giskard uses GPT-4 from OpenAI to evaluate the output of our model. However, I would like to replace GPT-4 with an open-source LLM-as-a-judge, specifically Ollama. I have already set up the Ollama client using below code (The one mentioned in the Giskard document).
import giskard
api_base = "http://localhost:11434" # Default api_base for local Ollama
giskard.llm.set_llm_model("ollama/llama3.1", disable_structured_output=True, api_base=api_base)
giskard.llm.set_embedding_model("ollama/nomic-embed-text", api_base=api_base)
Additionally, for confidentiality reasons, I want to replace the default LLM API calls (which use remote LLMs) with local LLMs (with Ollama call). I have set up the Ollama client locally (as shown above) and would like to know if this setup will replace all external LLM API calls with local LLMs, wherever Giskard relies on an external LLM.
Below are my questions:
I know the answer to the second question will also address the first one, but I would still like to ask the first one specifically 😄
The text was updated successfully, but these errors were encountered: