repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | from typing import Optional |
| #2 | |
| #3 | from embedchain.config.base_config import BaseConfig |
| #4 | |
| #5 | ANSWER_RELEVANCY_PROMPT = """ |
| #6 | Please provide $num_gen_questions questions from the provided answer. |
| #7 | You must provide the complete question, if are not able to provide the complete question, return empty string (""). |
| #8 | Please only provide one question per line without numbers or bullets to distinguish them. |
| #9 | You must only provide the questions and no other text. |
| #10 | |
| #11 | $answer |
| #12 | """ # noqa:E501 |
| #13 | |
| #14 | |
| #15 | CONTEXT_RELEVANCY_PROMPT = """ |
| #16 | Please extract relevant sentences from the provided context that is required to answer the given question. |
| #17 | If no relevant sentences are found, or if you believe the question cannot be answered from the given context, return the empty string (""). |
| #18 | While extracting candidate sentences you're not allowed to make any changes to sentences from given context or make up any sentences. |
| #19 | You must only provide sentences from the given context and nothing else. |
| #20 | |
| #21 | Context: $context |
| #22 | Question: $question |
| #23 | """ # noqa:E501 |
| #24 | |
| #25 | GROUNDEDNESS_ANSWER_CLAIMS_PROMPT = """ |
| #26 | Please provide one or more statements from each sentence of the provided answer. |
| #27 | You must provide the symantically equivalent statements for each sentence of the answer. |
| #28 | You must provide the complete statement, if are not able to provide the complete statement, return empty string (""). |
| #29 | Please only provide one statement per line WITHOUT numbers or bullets. |
| #30 | If the question provided is not being answered in the provided answer, return empty string (""). |
| #31 | You must only provide the statements and no other text. |
| #32 | |
| #33 | $question |
| #34 | $answer |
| #35 | """ # noqa:E501 |
| #36 | |
| #37 | GROUNDEDNESS_CLAIMS_INFERENCE_PROMPT = """ |
| #38 | Given the context and the provided claim statements, please provide a verdict for each claim statement whether it can be completely inferred from the given context or not. |
| #39 | Use only "1" (yes), "0" (no) and "-1" (null) for "yes", "no" or "null" respectively. |
| #40 | You must provide one verdict per line, ONLY WITH "1", "0" or "-1" as per your verdict to the given statement and nothing else. |
| #41 | You must provide the verdicts in the same order as the claim statements. |
| #42 | |
| #43 | Contexts: |
| #44 | $context |
| #45 | |
| #46 | Claim statements: |
| #47 | $claim_statements |
| #48 | """ # noqa:E501 |
| #49 | |
| #50 | |
| #51 | class GroundednessConfig(BaseConfig): |
| #52 | def __init__( |
| #53 | self, |
| #54 | model: str = "gpt-4", |
| #55 | api_key: Optional[str] = None, |
| #56 | answer_claims_prompt: str = GROUNDEDNESS_ANSWER_CLAIMS_PROMPT, |
| #57 | claims_inference_prompt: str = GROUNDEDNESS_CLAIMS_INFERENCE_PROMPT, |
| #58 | ): |
| #59 | self.model = model |
| #60 | self.api_key = api_key |
| #61 | self.answer_claims_prompt = answer_claims_prompt |
| #62 | self.claims_inference_prompt = claims_inference_prompt |
| #63 | |
| #64 | |
| #65 | class AnswerRelevanceConfig(BaseConfig): |
| #66 | def __init__( |
| #67 | self, |
| #68 | model: str = "gpt-4", |
| #69 | embedder: str = "text-embedding-ada-002", |
| #70 | api_key: Optional[str] = None, |
| #71 | num_gen_questions: int = 1, |
| #72 | prompt: str = ANSWER_RELEVANCY_PROMPT, |
| #73 | ): |
| #74 | self.model = model |
| #75 | self.embedder = embedder |
| #76 | self.api_key = api_key |
| #77 | self.num_gen_questions = num_gen_questions |
| #78 | self.prompt = prompt |
| #79 | |
| #80 | |
| #81 | class ContextRelevanceConfig(BaseConfig): |
| #82 | def __init__( |
| #83 | self, |
| #84 | model: str = "gpt-4", |
| #85 | api_key: Optional[str] = None, |
| #86 | language: str = "en", |
| #87 | prompt: str = CONTEXT_RELEVANCY_PROMPT, |
| #88 | ): |
| #89 | self.model = model |
| #90 | self.api_key = api_key |
| #91 | self.language = language |
| #92 | self.prompt = prompt |
| #93 |