Skip to content

fix: added support for google vertexAI #252

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

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

jjmachan
Copy link
Member

@jjmachan jjmachan commented Nov 3, 2023

added support for llm, chat and embeddings

from langchain.llms import VertexAI
from langchain.chat_models import ChatVertexAI
from ragas.llms import LangchainLLM
from ragas.metrics import faithfulness

llm = VertexAI(credentials=creds)
chat = ChatVertexAI(credentials=creds)

ragas_llm = LangchainLLM(llm)
faithfulness.llm = ragas_llm

if your looking to change the embeddings as well

from langchain.embeddings import VertexAIEmbeddings
from ragas.metrics import AnswerRelevancy

embeddings = VertexAIEmbeddings(credentials=creds)
ar = AnswerRelevancy(embeddings=embeddings)

# now you can use it as normal
r = evaluate(fiqa_eval.select(range(3)), metrics=[ar])

@jjmachan jjmachan merged commit 55d00da into explodinggradients:main Nov 3, 2023
@jjmachan jjmachan deleted the fix/vertextai branch November 3, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant