Skip to content

Commit b3bce6d

Browse files
author
tomfrenken
committed
update readmes and types
1 parent 1442426 commit b3bce6d

File tree

7 files changed

+14
-269
lines changed

7 files changed

+14
-269
lines changed

.changeset/clear-suns-sleep.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
---
2-
'@sap-ai-sdk/orchestration': minor
32
'@sap-ai-sdk/langchain': minor
4-
'@sap-ai-sdk/smoke-tests': minor
5-
'@sap-ai-sdk/e2e-tests': minor
6-
'@sap-ai-sdk/sample-code': minor
7-
'@sap-ai-sdk/sample-cap': minor
83
---
94

105
[New Functionality] Add LangChain Orchestration client.

packages/langchain/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ This package provides LangChain model clients built on top of the foundation mod
1010
- [Prerequisites](#prerequisites)
1111
- [Relationship between Models and Deployment ID](#relationship-between-models-and-deployment-id)
1212
- [Usage](#usage)
13-
- [Client Initialization](#client-initialization)
14-
- [Chat Client](#chat-client)
15-
- [Embedding Client](#embedding-client)
13+
- [SAP Orchestration Service](#sap-orchestration-service)
14+
- [Azure OpenAI](#azure-openai)
1615
- [Local Testing](#local-testing)
1716
- [Support, Feedback, Contribution](#support-feedback-contribution)
1817
- [License](#license)
@@ -55,12 +54,17 @@ Consequently, each deployment ID and resource group uniquely map to a combinatio
5554

5655
## Usage
5756

58-
This package offers both chat and embedding clients, currently supporting Azure OpenAI.
59-
Also supports the SAP Orchestration service.
57+
This package offers LangChain clients for Azure OpenAI as well as the SAP orchestration service
6058
All clients comply with [LangChain's interface](https://js.langchain.com/docs/introduction).
6159

6260
### SAP Orchestration Service
6361

62+
For details on the orchestration client, refer to this [document](./src/orchestration/README.md).
63+
64+
### Azure OpenAI
65+
66+
For details on the Azure OpenAI clients, refer to this [document](./src/openai/README.md).
67+
6468
## Local Testing
6569

6670
For local testing instructions, refer to this [section](https://github.com/SAP/ai-sdk-js/blob/main/README.md#local-testing).

packages/langchain/src/README.md

Lines changed: 0 additions & 206 deletions
This file was deleted.

packages/langchain/src/openai/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Consequently, each deployment ID and resource group uniquely map to a combinatio
5555

5656
## Usage
5757

58-
This package offers both chat and embedding clients, currently supporting Azure OpenAI.
58+
This package offers both chat and embedding clients for Azure OpenAI.
5959
All clients comply with [LangChain's interface](https://js.langchain.com/docs/introduction).
6060

6161
### Client Initialization
@@ -74,7 +74,7 @@ const chatClient = new AzureOpenAiChatClient({ modelName: 'gpt-4o' });
7474
const embeddingClient = new AzureOpenAiEmbeddingClient({ modelName: 'gpt-4o' });
7575
```
7676

77-
In addition to the default parameters of the model vendor (e.g., OpenAI) and LangChain, additional parameters can be used to help narrow down the search for the desired model:
77+
In addition to the default parameters of Azure OpenAI and LangChain, additional parameters can be used to help narrow down the search for the desired model:
7878

7979
```ts
8080
const chatClient = new AzureOpenAiChatClient({

packages/langchain/src/orchestration/README.md

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -155,54 +155,6 @@ return llmChain.invoke({
155155
});
156156
```
157157

158-
### Embedding Client
159-
160-
Embedding clients allow embedding either text or document chunks (represented as arrays of strings).
161-
While you can use them standalone, they are usually used in combination with other LangChain utilities, like a text splitter for preprocessing and a vector store for storage and retrieval of the relevant embeddings.
162-
For a complete example how to implement RAG with our LangChain client, take a look at our [sample code](https://github.com/SAP/ai-sdk-js/blob/main/sample-code/src/langchain-azure-openai.ts).
163-
164-
#### Embed Text
165-
166-
```ts
167-
const embeddedText = await embeddingClient.embedQuery(
168-
'Paris is the capital of France.'
169-
);
170-
```
171-
172-
#### Embed Document Chunks
173-
174-
```ts
175-
const embeddedDocuments = await embeddingClient.embedDocuments([
176-
'Page 1: Paris is the capital of France.',
177-
'Page 2: It is a beautiful city.'
178-
]);
179-
```
180-
181-
#### Preprocess, embed, and store documents
182-
183-
```ts
184-
// Create a text splitter and split the document
185-
const textSplitter = new RecursiveCharacterTextSplitter({
186-
chunkSize: 2000,
187-
chunkOverlap: 200
188-
});
189-
const splits = await textSplitter.splitDocuments(docs);
190-
191-
// Initialize the embedding client
192-
const embeddingClient = new AzureOpenAiEmbeddingClient({
193-
modelName: 'text-embedding-ada-002'
194-
});
195-
196-
// Create a vector store from the document
197-
const vectorStore = await MemoryVectorStore.fromDocuments(
198-
splits,
199-
embeddingClient
200-
);
201-
202-
// Create a retriever for the vector store
203-
const retriever = vectorStore.asRetriever();
204-
```
205-
206158
## Local Testing
207159

208160
For local testing instructions, refer to this [section](https://github.com/SAP/ai-sdk-js/blob/main/README.md#local-testing).

packages/langchain/src/orchestration/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { CustomRequestConfig } from '@sap-ai-sdk/core';
77
*/
88
export type OrchestrationCallOptions = Pick<
99
BaseChatModelCallOptions,
10-
'stop' | 'signal' | 'timeout'
10+
'stop' | 'signal' | 'timeout' | 'callbacks' | 'metadata' | 'runId' | 'runName' | 'tags'
1111
> & {
1212
customRequestConfig?: CustomRequestConfig;
1313
tools?: Template['tools'];

sample-code/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ The `toContentStream()` method is called to extract the content of the chunk for
204204

205205
Once the streaming is done, finish reason and token usage are printed out.
206206

207-
### Langchain
207+
### LangChain
208208

209209
#### Invoke with a Simple Input
210210

211211
`GET /langchain/invoke`
212212

213-
Invoke langchain Azure OpenAI client with a simple input to get chat completion response.
213+
Invoke LangChain Azure OpenAI client with a simple input to get chat completion response.
214214

215215
#### Invoke a Chain for Templating
216216

0 commit comments

Comments
 (0)