Compare commits

...

22 Commits

Author SHA1 Message Date
sweep-ai[bot] ea98806f03 feat: Updated packages/core/src/llm/pythonLlamaCpp 2023-12-14 09:55:00 +00:00
sweep-ai[bot] 20c8ae020c Merge main into sweep/add-api-support 2023-10-06 01:37:40 +00:00
sweep-ai[bot] d82a42bcdf Merge main into sweep/add-api-support 2023-10-06 01:37:24 +00:00
sweep-ai[bot] bfd3f304a3 Merge main into sweep/add-api-support 2023-10-03 21:48:46 +00:00
sweep-ai[bot] 095268a2ce Merge main into sweep/add-api-support 2023-10-03 21:48:22 +00:00
sweep-ai[bot] 3dd35f6efd Merge main into sweep/add-api-support 2023-10-03 18:12:19 +00:00
sweep-ai[bot] 6aa81e0344 Merge main into sweep/add-api-support 2023-09-26 22:34:54 +00:00
sweep-ai[bot] 7ebfb4a1f5 Merge main into sweep/add-api-support 2023-09-26 22:30:55 +00:00
sweep-ai[bot] e0fee92ac8 Merge main into sweep/add-api-support 2023-09-26 22:25:37 +00:00
sweep-ai[bot] 7bbe330659 Merge main into sweep/add-api-support 2023-09-14 17:47:37 +00:00
sweep-ai[bot] 3cf6cbdaea Merge main into sweep/add-api-support 2023-09-14 16:32:42 +00:00
sweep-ai[bot] 00942e1ff2 Merge main into sweep/add-api-support 2023-09-12 04:53:34 +00:00
sweep-ai[bot] 162df981e7 Merge main into sweep/add-api-support 2023-09-11 18:14:28 +00:00
sweep-ai[bot] a9318003af Merge main into sweep/add-api-support 2023-09-11 17:45:43 +00:00
sweep-ai[bot] 702dacf432 Merge main into sweep/add-api-support 2023-09-11 17:33:56 +00:00
sweep-ai[bot] e198af50b0 Merge main into sweep/add-api-support 2023-09-11 17:33:06 +00:00
sweep-ai[bot] 83d9be4556 Merge main into sweep/add-api-support 2023-09-11 17:12:43 +00:00
sweep-ai[bot] e764c05a7a Updated README.md 2023-09-11 15:49:34 +00:00
sweep-ai[bot] 1378388dd5 Updated packages/core/src/index.ts 2023-09-11 15:39:02 +00:00
sweep-ai[bot] 84ad529918 Add OobaTextGeneration connector 2023-09-11 15:31:26 +00:00
sweep-ai[bot] e362d48a0a Add HuggingFacesTextGeneration connector 2023-09-11 15:20:45 +00:00
sweep-ai[bot] c070855782 Add PythonLlamaCpp connector for python llama cpp 2023-09-11 15:11:53 +00:00
5 changed files with 79 additions and 0 deletions
+6
View File
@@ -90,6 +90,12 @@ Check out our NextJS playground at https://llama-playground.vercel.app/. The sou
- Anthropic Claude Instant and Claude 2
- Llama2 Chat LLMs (70B, 13B, and 7B parameters)
## Supported APIs:
- Python Llama CPP API: A Python binding for the llama.cpp library, providing low-level access to the C API of llama.cpp and a high-level Python API for text completion.
- Hugging Faces Text Generation Inference: A large language model text generation inference tool, used in production at HuggingFace to power Hugging Chat, the Inference API, and Inference Endpoint.
- Ooba Text Generation API: A Gradio web UI for Large Language Models, supporting transformers, GPTQ, llama.cpp (GGUF), and Llama models.
## Contributing:
We are in the very early days of LlamaIndex.TS. If youre interested in hacking on it with us check out our [contributing guide](/CONTRIBUTING.md)
+3
View File
@@ -15,6 +15,9 @@ export * from "./TextSplitter";
export * from "./Tool";
export * from "./constants";
export * from "./llm/LLM";
export * from "./llm/PythonLlamaCpp";
export * from "./llm/HuggingFacesTextGeneration";
export * from "./llm/OobaTextGeneration";
export * from "./indices";
@@ -0,0 +1,27 @@
import axios from 'axios';
class HuggingFacesTextGeneration {
private apiKey: string;
constructor(apiKey: string) {
this.apiKey = apiKey;
}
async generateText(prompt: string) {
const response = await axios.post(
'https://api.huggingface.co/text-generation',
{
prompt,
},
{
headers: {
'Authorization': `Bearer ${this.apiKey}`,
},
},
);
return response.data;
}
}
export default HuggingFacesTextGeneration;
@@ -0,0 +1,18 @@
import axios from 'axios';
export class OobaTextGeneration {
private apiKey: string;
constructor(apiKey: string) {
this.apiKey = apiKey;
}
async generateText(prompt: string) {
const response = await axios.post('https://api.ooba.ai/generate', {
prompt,
apiKey: this.apiKey,
});
return response.data;
}
}
+25
View File
@@ -0,0 +1,25 @@
import { LlamaCpp } from 'node-llama-cpp';
export class PythonLlamaCpp {
private llamaCpp: LlamaCpp;
constructor(apiKey: string) {
this.llamaCpp = new LlamaCpp(apiKey);
}
async request(query: string) {
try {
const response = await this.llamaCpp.complete(query);
return this.handleResponse(response);
} catch (error) {
console.error('Error making request to python llama cpp API:', error);
throw error;
}
}
handleResponse(response: any) {
// Process the response from the API
// This will depend on the structure of the response
return response;
}
}