MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / askLLM

Method askLLM

packages/llm/src/langchain.ts:137–166  ·  view source on GitHub ↗
({
    query,
    vectorStore,
  }: {
    query: string;
    vectorStore: FaissStore;
  })

Source from the content-addressed store, hash-verified

135
136 @measure
137 private static async askLLM({
138 query,
139 vectorStore,
140 }: {
141 query: string;
142 vectorStore: FaissStore;
143 }) {
144 const template = `Use the following pieces of context to answer the question at the end.
145If you don't know the answer, just say that you don't know, DON'T try to make up an answer.
146Keep the answer as concise as possible.
147DON'T crop the answer, ensure the answer is complete.
148No need to say "thanks for asking!" in the answer.
149Context: {context}
150Question: {question}
151Helpful Answer:`;
152
153 const chain = RetrievalQAChain.fromLLM(
154 model,
155 vectorStore.asRetriever({ k: env.CHUNKS * 2 }),
156 {
157 prompt: PromptTemplate.fromTemplate(template),
158 returnSourceDocuments: true,
159 }
160 );
161
162 const response = await chain.call({
163 query,
164 });
165 return response;
166 }
167
168 @measure
169 private static async crawl(url: string, options: CrawlOptions) {

Callers 1

predictMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected