Skip to content

embedding factoryΒ #1425

@amin-kh96

Description

@amin-kh96

I checked the evaluate function and deep inside there is a function called 'embedding_factory'.
by default it use openai I put the whole function here.

def embedding_factory(
model: str = "text-embedding-ada-002", run_config: t.Optional[RunConfig] = None
) -> BaseRagasEmbeddings:
openai_embeddings = OpenAIEmbeddings(model=model)
if run_config is not None:
openai_embeddings.request_timeout = run_config.timeout
else:
run_config = RunConfig()
return LangchainEmbeddingsWrapper(openai_embeddings, run_config=run_config)

and I did this also:

Assuming custom_embeddings is an instance of your CustomHuggingFaceRagasEmbeddings

evaluation_report = evaluate(ragas_data, metrics=metrics, embeddings=custom_embeddings)

but it says the same error of API again,
I want to substitute the output of a function called embedded factory with my computed embeddings. because I already have the computed embeddings both for the answer and the question and also the context in a Ragas data frame. I have every number (float) needed for the computation. but ragas evaluate function does the computation again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredπŸ€– The question has been answered. Will be closed automatically if no new commentsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions