Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support custom destination #351

Merged
merged 23 commits into from
Dec 13, 2024
Merged

Conversation

ZhongpinWang
Copy link
Contributor

@ZhongpinWang ZhongpinWang commented Dec 6, 2024

Context

Closes SAP/ai-sdk-js-backlog#163.

Caution

Option 1: Do not merge until #335 is merged and custom destination is also supported in document grounding with documentation added.
✔️ Option 2: Merge this PR first, then adapt #335 to support custom destination in document grounding.

With this PR, you can provide your own destination to execute any request.

For pure clients like ai-api, provide destination when calling execute() method:

await DeploymentApi.deploymentDelete(deploymentId, {
  'AI-Resource-Group': 'default'
}).execute({
  destinationName: 'destinationName'
});

For azure-openai, orchestration and langchain clients, provide destination with the constructor:

new AzureOpenAiChatClient('gpt-4', {
  destinationName: 'destinationName'
});
new OrchestrationClient(
  {
    templating: {
      template: [{ role: 'user', content: 'Hello!' }]
    },
    llm: {
      model_name: 'gpt-35-turbo-16k',
      model_params: {}
    }
  },
  {
    resourceGroup: 'resourceGroup'
  },
  {
    destinationName: 'destinationName'
  }
);
new AzureOpenAiChatClient(
  {
    modelName: 'gpt-4o',
    modelVersion: '24-07-2021',
    resourceGroup: 'my-resource-group'
  },
  {
    destinatioName: 'my-destination'
  }
);

Definition of Done

  • Code is tested (Unit, E2E)
  • [ ] Error handling created / updated & covered by the tests above
  • Documentation updated
  • (Optional) Aligned changes with the Java SDK
  • (Optional) Release notes updated (Double check again)

Copy link
Contributor

@deekshas8 deekshas8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the versioning and then it's good to go.

@ZhongpinWang ZhongpinWang enabled auto-merge (squash) December 12, 2024 12:09
Copy link
Contributor

@KavithaSiva KavithaSiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, Just clarifying two questions before approving :)

packages/core/src/http-client.ts Show resolved Hide resolved
packages/langchain/README.md Show resolved Hide resolved
Copy link
Contributor

@KavithaSiva KavithaSiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZhongpinWang ZhongpinWang merged commit b4a5506 into main Dec 13, 2024
10 checks passed
@ZhongpinWang ZhongpinWang deleted the feat-support-destination branch December 13, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants