Skip to content

Commit

Permalink
chore: update docs for orama sdk monorepo (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
matijagaspar authored Nov 18, 2024
2 parents 89cc661 + 9e4e3e9 commit 1d25adb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Orama Cloud provides an official SDK to help you integrate your indexes into you

You can install the SDK using `npm`, `yarn`, `pnpm`, `bun`, or any other package manager of your choice:

<Install pkg="@oramacloud/client" />
<Install pkg="@oramacloud/react-client" />

When developing using Deno, you can import the SDK using the `npm` namespace:

```typescript copy
import { OramaCloud } from "npm:@oramacloud/client/react";
import { OramaCloud } from "npm:@oramacloud/react-client";
```

This SDK aims to be 100% compatible with every JavaScript environment, including Node.js, Deno, Bun, and browsers.
Expand All @@ -32,7 +32,7 @@ As a first step please add the Provider component at the top of your React tree:
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import { OramaCloud } from "@oramacloud/client/react";
import { OramaCloud } from "@oramacloud/react-client";

ReactDOM.createRoot(document.getElementById("root")).render(
<OramaCloud endpoint="<your-endpoint>" apiKey="<your-apikey>">
Expand Down Expand Up @@ -61,7 +61,7 @@ The SDK provides a hook to interact with the Orama Cloud API. Here is a list of
The react hooks wraps the [open source search method](/open-source/usage/search/introduction), maintaining backward compatibility with the Open Source API.

```tsx copy
import { useSearch } from "@oramacloud/client/react";
import { useSearch } from "@oramacloud/react-client";

function Search() {
const { results, error } = useSearch({
Expand All @@ -86,7 +86,7 @@ function Search() {
You can perform a vector search using the `useSearch` hook by changing the mode, for example:

```tsx copy
import { useSearch } from "@oramacloud/client/react";
import { useSearch } from "@oramacloud/react-client";

function Search() {
const { results, error } = useSearch({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Orama Cloud provides an Official SDK to help you integrate your indexes into you
You can install the SDK using `npm`, `yarn`, `pnpm` or any other package manager of your choice:

<Install pkg="@oramacloud/client" />
and
<Install pkg="@oramacloud/client-vue" />

## Usage

Expand Down Expand Up @@ -50,7 +52,7 @@ The vue composable wraps the [open source search method](/open-source/usage/sear
```vue
<script setup>
import { client } from "./orama";
import { useSearch } from "@oramacloud/client/vue";
import { useSearch } from "@oramacloud/vue-client";
const { results } = useSearch({
client,
Expand All @@ -72,7 +74,7 @@ You can perform a vector search using the `useSearch` hook by changing the mode,
```vue
<script setup>
import { client } from "./orama";
import { useSearch } from "@oramacloud/client/vue";
import { useSearch } from "@oramacloud/vue-client";
const { results } = useSearch({
client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ By selecting the "Encrypt chat messages" option, the Secure Proxy will provide e
The Secure Proxy can be used in two ways:

1. Using the `@orama/plugin-secure-proxy` npm package (see [the official plugin documentation](/open-source/plugins/plugin-secure-proxy) for details). This will allow you to perform hybrid and vector search with your Orama OSS instance with very little configuration.
2. Using the `@oramacloud/client` npm package.
2. Using the `@oramacloud/secure-proxy` npm package.

By utilizing the `@oramacloud/client` npm package, you can generate embeddings and interact with OpenAI's GPT browser models without exposing your OpenAI API key or prompts to your users.
By utilizing the `@oramacloud/secure-proxy` npm package, you can generate embeddings and interact with OpenAI's GPT browser models without exposing your OpenAI API key or prompts to your users.

### Generating embeddings

To generate text embeddings, simply import the OramaProxy class, initialize it, and call the generateEmbeddings method:

```js
import { OramaProxy } from "@oramacloud/client";
import { OramaProxy } from "@oramacloud/secure-proxy";

const proxy = new OramaProxy({
api_key: "<YOUR API KEY>",
Expand Down Expand Up @@ -134,7 +134,7 @@ You can accomplish this in two ways: either store the entire response in a singl
**Using a single variable**:

```js
import { OramaProxy } from '@oramacloud/client'
import { OramaProxy } from '@oramacloud/secure-proxy'

const proxy = new OramaProxy({
api_key: '<YOUR API KEY>'
Expand All @@ -154,7 +154,7 @@ console.log(response)
**Using async iterators**:

```js
import { OramaProxy } from '@oramacloud/client'
import { OramaProxy } from '@oramacloud/secure-proxy'

const proxy = new OramaProxy({
api_key: 'zrqplaxa-H46c3f-D9vk8Fg_eJlomMP3'
Expand Down

0 comments on commit 1d25adb

Please sign in to comment.