Skip to content

Commit

Permalink
updated reference to QvikChat NPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-kural committed Jul 7, 2024
1 parent fe1d535 commit 708876d
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 56 deletions.
10 changes: 5 additions & 5 deletions pages/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ To enable authentication, set the `enableAuth` option to `true` when configuring
For example, the following code snippet demonstrates how to enable authentication using a Firestore API key store:

```typescript copy {20}
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreAPIKeyStore } from "qvikchat/auth";
import { defineChatEndpoint } from "qvikchat/endpoints";
import { ChatAgent } from "qvikchat/agents";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreAPIKeyStore } from "@oconva/qvikchat/auth";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand Down Expand Up @@ -49,7 +49,7 @@ The API key store is a collection of API key records. It is used to manage API k
You can implement your own API Key Store by implementing the `APIKeyStore` interface. The following code snippet demonstrates how to create a custom API key store:

```typescript copy
import { APIKeyStore } from "qvikchat/auth";
import { APIKeyStore } from "@oconva/qvikchat/auth";

export class CustomAPIKeyStore implements APIKeyStore {
// Implement the APIKeyStore interface
Expand Down
10 changes: 5 additions & 5 deletions pages/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The cache store is a collection of cache records. It is used to manage cache rec
You can implement your own cache store by implementing the `CacheStore` interface. The following code snippet demonstrates how to create a custom cache store:

```typescript copy
import { CacheStore } from "qvikchat/cache";
import { CacheStore } from "@oconva/qvikchat/cache";

export class CustomCacheStore implements CacheStore {
// Implement the CacheStore interface
Expand Down Expand Up @@ -149,10 +149,10 @@ The in-memory cache store is a simple implementation of the cache store that sto
To use a custom cache store in your QvikChat endpoint configurations, you need to provide an instance of the cache store in the endpoint configurations. The following code snippet demonstrates how to add a Firestore cache store to the endpoint configurations:

```typescript copy {20}
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreCacheStore } from "qvikchat/cache";
import { defineChatEndpoint } from "qvikchat/endpoints";
import { ChatAgent } from "qvikchat/agents";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreCacheStore } from "@oconva/qvikchat/cache";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand Down
8 changes: 4 additions & 4 deletions pages/chat-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The `ChatAgent` class can be used to create different types of chat agents based
Example of defining a `close-ended` chat agent:

```typescript copy
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Define a close-ended chat agent
const closeEndedChatAgent = new ChatAgent({
Expand Down Expand Up @@ -58,7 +58,7 @@ gpt4
### Specifying Model

```typescript copy {7}
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Define a close-ended chat agent with a specific LLM model
const closeEndedChatAgent = new ChatAgent({
Expand All @@ -73,7 +73,7 @@ const closeEndedChatAgent = new ChatAgent({
You can, optionally, also provide additional configuration options for the LLM model.

```typescript copy {7-17}
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Define a chat agent with a specific LLM model and configuration
const chatAgent = new ChatAgent({
Expand Down Expand Up @@ -157,7 +157,7 @@ export const defaultChatAgentConfig: DefaultChatAgentConfigType = {
You can generate responses to user queries using the `generateResponse` method of the `ChatAgent` class.

```typescript copy
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Define a chat agent
const chatAgent = new ChatAgent();
Expand Down
2 changes: 1 addition & 1 deletion pages/chat-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All chat endpoints can be defined using a single method: `defineChatEndpoint`. T
You can import the `defineChatEndpoint` method as shown below:

```typescript copy
import { defineChatEndpoint } from "qvikchat/endpoints";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
```

Below are the three types of chat agents you can define:
Expand Down
2 changes: 1 addition & 1 deletion pages/chat-endpoints/chat-endpoint-configurations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can configure a chat endpoint with various features such as chat history, response caching, and API key authentication, by simply modifying the configurations provided to the `defineChatEndpoint` function. To use this, first import the method as following:

```typescript copy
import { defineChatEndpoint } from "qvikchat/endpoints";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
```

Below are some of the chat endpoint configurations you can define.
Expand Down
2 changes: 1 addition & 1 deletion pages/chat-endpoints/close-ended-chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Chat endpoint where user queries are restricted to a specific topic. Prevents mi
You can define an close-ended chat endpoint with various features such as chat history, response caching, and API key authentication, by simply modifying the configurations provided to the `defineChatEndpoint` function. To use this, first import the method as following:

```typescript copy
import { defineChatEndpoint } from "qvikchat/endpoints";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
```

Below are some of the close-ended chat endpoints you can define.
Expand Down
4 changes: 2 additions & 2 deletions pages/chat-endpoints/open-ended-chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Unrestricted chat with no restrictions on what topic the user queries can be rel
You can define an open-ended chat endpoint with various features such as chat history, response caching, and API key authentication, by simply modifying the configurations provided to the `defineChatEndpoint` function. To use this, first import the method as following:

```typescript
import { defineChatEndpoint } from "qvikchat/endpoints";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
```

Below are some of the open-ended chat endpoints you can define.
Expand Down Expand Up @@ -134,7 +134,7 @@ For failed requests, the response will contain:
Below is an example of how you can define an open-ended chat endpoint that supports chat history. Simply, set the `useChatHistory` flag to `true` and provide an a chat history store. For testing, you may use the in-memory chat history store.

```typescript copy
import { InMemoryChatHistoryStore } from "qvikchat/history";
import { InMemoryChatHistoryStore } from "@oconva/qvikchat/history";

// Open-ended chat endpoint with support for chat history
defineChatEndpoint({
Expand Down
8 changes: 4 additions & 4 deletions pages/chat-endpoints/rag-chat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Context-aware and topic-specific chat with ability to answer user queries by ret
You can define an RAG chat endpoint with various features such as chat history, response caching, and API key authentication, by simply modifying the configurations provided to the `defineChatEndpoint` function. To use this, first import the method as following:

```typescript
import { defineChatEndpoint } from "qvikchat/endpoints";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
```

Below are some of the RAG chat endpoints you can define.
Expand Down Expand Up @@ -65,7 +65,7 @@ For failed requests, the response will contain:
Below example uses a RAG agent to answer user queries related to 'Store Inventory Data'. We'll index this data, store it in a vector store, and use a vector store retriever to retrieve the data when answering user queries.

```typescript copy {13}
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";

// Index inventory data and get retriever
const inventoryDataRetriever = await getDataRetriever({
Expand Down Expand Up @@ -152,7 +152,7 @@ Below example hows how you can define a RAG chat endpoint that supports chat his
Below RAG agent answers user queries related to 'Store Inventory Data'. We'll index this data, store it in a vector store, and use a vector store retriever to retrieve the data when answering user queries.

```typescript copy
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";

// Index inventory data and get retriever
const inventoryDataRetriever = await getDataRetriever({
Expand Down Expand Up @@ -251,7 +251,7 @@ Below example shows how you can define a RAG chat endpoint that supports chat hi
Below example uses a RAG agent to answer user queries related to 'Store Inventory Data'. We'll index this data, store it in a vector store, and use a vector store retriever to retrieve the data when answering user queries.

```typescript copy
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";

// Index inventory data and get retriever
const inventoryDataRetriever = await getDataRetriever({
Expand Down
8 changes: 4 additions & 4 deletions pages/chat-history.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface ChatHistoryStore {
You can provide an instance of a chat history store to the `defineChatEndpoint` function. The chat endpoint will use this store to manage chat histories.

```typescript copy
import { InMemoryChatHistoryStore } from "qvikchat/history";
import { InMemoryChatHistoryStore } from "@oconva/qvikchat/history";

// Open-ended chat endpoint with support for chat history
defineChatEndpoint({
Expand All @@ -105,8 +105,8 @@ defineChatEndpoint({
You can use Firebase Firestore as a chat history store. Remember to initialize the Firebase app before using it. To learn more about initializing the Firebase app, check [Initialize Firebase App](/integrations/firebase#initialize-firebase-app)

```typescript copy
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreChatHistoryStore } from "qvikchat/history";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreChatHistoryStore } from "@oconva/qvikchat/history";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand All @@ -120,4 +120,4 @@ defineChatEndpoint({
collectionName: "chat-history",
}),
});
```
```
8 changes: 4 additions & 4 deletions pages/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ QvikChat is a framework built on top of Firebase Genkit and LangChain. It allows
You can install QvikChat using the following command:

```bash copy
npm install qvikchat
npm install @oconva/qvikchat
```

Or

```bash copy
pnpm add qvikchat
pnpm add @oconva/qvikchat
```

## Usage
Expand All @@ -25,8 +25,8 @@ Before you can deploy your chat endpoints, you need to setup Firebase Genkit, ei
Create a `index.ts` (or `index.js`) file and add the following code:

```typescript copy filename="index.ts"
import { runServer, setupGenkit } from "qvikchat/genkit";
import { defineChatEndpoint } from "qvikchat/endpoints";
import { runServer, setupGenkit } from "@oconva/qvikchat/genkit";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";

// Setup Genkit
setupGenkit();
Expand Down
28 changes: 14 additions & 14 deletions pages/integrations/firebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To setup Firebase for use with QvikChat, you need to do two things:
1. Modify your genkit configurations that you provide to the `setupGenkit` function to include the Firebase configurations, and specify your Firebase project ID.

```typescript copy
import { setupGenkit } from "qvikchat/genkit";
import { setupGenkit } from "@oconva/qvikchat/genkit";

// Setup Genkit with Firebase project
setupGenkit({
Expand All @@ -34,7 +34,7 @@ That's it! You have successfully setup Firebase for use with QvikChat. You can n
To initialize a Firebase app, you can use the `getFirebaseApp` function provided by QvikChat.

```typescript copy
import { getFirebaseApp } from "qvikchat/integrations/firebase";
import { getFirebaseApp } from "@oconva/qvikchat/integrations/firebase";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand All @@ -45,7 +45,7 @@ When calling the `getFirebaseApp` function without passing any value for the `cr
You can provide additional configurations to the `getFirebaseApp` function. For example, you can specify the path to the service account credentials file and the provide project ID.

```typescript copy
import { getFirebaseApp, credential } from "qvikchat/firebase";
import { getFirebaseApp, credential } from "@oconva/qvikchat/firebase";

// Initialize Firebase App with additional configurations
getFirebaseApp({
Expand Down Expand Up @@ -78,9 +78,9 @@ For more information on how to initialize a Firebase app when using `firebase-ad
You can use Firestore as a chat history store. To do this, you need to provide the Firestore chat history store to the `ChatAgent` constructor.

```typescript copy
import { ChatAgent } from "qvikchat/agents";
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreChatHistoryStore } from "qvikchat/history";
import { ChatAgent } from "@oconva/qvikchat/agents";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreChatHistoryStore } from "@oconva/qvikchat/history";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand All @@ -100,10 +100,10 @@ const chatAgent = new ChatAgent({
You can use Firestore as a cache store. To do this, you need to provide the Firestore cache store as the `cacheStore` to the endpoint configurations.

```typescript copy {20}
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreCacheStore } from "qvikchat/cache";
import { defineChatEndpoint } from "qvikchat/endpoints";
import { ChatAgent } from "qvikchat/agents";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreCacheStore } from "@oconva/qvikchat/cache";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand All @@ -128,10 +128,10 @@ defineChatEndpoint({
You can use Firestore as an API key store. To do this, you need to provide the Firestore API key store as the `apiKeyStore` to the endpoint configurations.

```typescript copy {20}
import { getFirebaseApp } from "qvikchat/firebase";
import { FirestoreAPIKeyStore } from "qvikchat/auth";
import { defineChatEndpoint } from "qvikchat/endpoints";
import { ChatAgent } from "qvikchat/agents";
import { getFirebaseApp } from "@oconva/qvikchat/firebase";
import { FirestoreAPIKeyStore } from "@oconva/qvikchat/auth";
import { defineChatEndpoint } from "@oconva/qvikchat/endpoints";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Initialize Firebase App
const firebaseApp = getFirebaseApp();
Expand Down
6 changes: 3 additions & 3 deletions pages/prompts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Be careful when defining system prompts. They should be clear, concise, and unam

```typescript copy
import { defineDotprompt } from "@genkit-ai/dotprompt";
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";

// Chat agent with a custom system prompt
const funnyChatAgent = new ChatAgent({
Expand Down Expand Up @@ -45,7 +45,7 @@ const funnyChatAgent = new ChatAgent({
You can also override the pre-configured system prompt of a chat agent by providing a custom system prompt when calling the `generateResponse` method of the chat agent.

```typescript copy {10-31}
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";
import { defineDotprompt } from "@genkit-ai/dotprompt";

// Define an open-ended chat agent
Expand Down Expand Up @@ -116,7 +116,7 @@ Start the message with "Sure, here is..." and provide the user with the requeste
You can then use the chat prompt when generating a response to a user query.

```typescript copy {10-31}
import { ChatAgent } from "qvikchat/agents";
import { ChatAgent } from "@oconva/qvikchat/agents";
import { defineDotprompt } from "@genkit-ai/dotprompt";

// Define an open-ended chat agent
Expand Down
6 changes: 3 additions & 3 deletions pages/rag-guide/data-ingestion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To use an embedding model, simply provide the instance to the `getDataRetriever`

```typescript copy
// import embedding model
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";
import { OpenAIEmbeddings } from "@langchain/openai";

// Index data and get retriever
Expand All @@ -66,8 +66,8 @@ QvikChat provides support for more than 30+ vector stores such as Faiss, Pinecon
To use a vector store, simply provide the instance to the `getDataRetriever` method. The below example shows how you can use a Faiss vector store to store the embeddings. You will need to provide the vector store instance the embedding model you want to use with it. If you wish to use a Google Gen AI or an OpenAI embedding model, you can use the `getEmbeddingModel` method to get the embedding model instance.

```typescript copy
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getEmbeddingModel } from "qvikchat/embedding-models";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";
import { getEmbeddingModel } from "@oconva/qvikchat/embedding-models";
import { FaissStore } from "@langchain/community/vectorstores/faiss";

// Index data and get retriever
Expand Down
6 changes: 3 additions & 3 deletions pages/rag-guide/embedding-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To use an embedding model, simply provide the instance to the `getDataRetriever`

```typescript copy
// import embedding model
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";
import { OpenAIEmbeddings } from "@langchain/openai";

// Index data and get retriever
Expand All @@ -25,8 +25,8 @@ const dataRetriever = await getDataRetriever({
If you wish to use a Google Gen AI or an OpenAI embedding model, you can use the `getEmbeddingModel` method to get the embedding model instance.

```typescript copy
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getEmbeddingModel } from "qvikchat/embedding-models";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";
import { getEmbeddingModel } from "@oconva/qvikchat/embedding-models";
import { FaissStore } from "@langchain/community/vectorstores/faiss";

// Index data and get retriever
Expand Down
4 changes: 2 additions & 2 deletions pages/rag-guide/vector-stores.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ QvikChat provides support for more than 30+ vector stores such as Faiss, Pinecon
To use a vector store, simply provide the instance to the `getDataRetriever` method. The below example shows how you can use a Faiss vector store to store the embeddings. You will need to provide the vector store instance the embedding model you want to use with it. If you wish to use a Google Gen AI or an OpenAI embedding model, you can use the `getEmbeddingModel` method to get the embedding model instance.

```typescript copy
import { getDataRetriever } from "qvikchat/data-retrievers";
import { getEmbeddingModel } from "qvikchat/embedding-models";
import { getDataRetriever } from "@oconva/qvikchat/data-retrievers";
import { getEmbeddingModel } from "@oconva/qvikchat/embedding-models";
import { FaissStore } from "@langchain/community/vectorstores/faiss";

// Index data and get retriever
Expand Down

0 comments on commit 708876d

Please sign in to comment.