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

[Feature Request]: #2194

Open
Drahokma opened this issue Nov 20, 2024 · 0 comments
Open

[Feature Request]: #2194

Drahokma opened this issue Nov 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Drahokma
Copy link

Drahokma commented Nov 20, 2024

Scenario

Hi,
it would be great to use the file_search with vector store defined in the assistants playground. In the playground asking questions based on the file-search works very well. It would be great to connect the predefined vector store to the teams ai assistant planner. So far I was not able to set up the file_search option to be enabled and the assistant in the teams ai library does not use predefined vector store.

import { MemoryStorage, MessageFactory, TurnContext } from "botbuilder";

// See https://aka.ms/teams-ai-library to learn more about the Teams AI library.
import { Application, AI, preview } from "@microsoft/teams-ai";

import config from "../config";

// See README.md to prepare your own Azure OpenAI Assistant
if (!config.azureOpenAIKey || !config.azureOpenAIAssistantId) {
  throw new Error(
    "Missing AZURE_OPENAI_API_KEY or AZURE_OPENAI_ASSISTANT_ID. See README.md to prepare your own Azure OpenAI Assistant."
  );
}

import { resetMessage } from "./messages";
import { httpErrorAction, searchDocuments } from "./actions";

// Create AI components
// Use OpenAI
const planner = new preview.AssistantsPlanner({
   apiKey: config.azureOpenAIKey,
   assistant_id: config.azureOpenAIAssistantId,
   endpoint: config.azureOpenAIEndpoint
});

// Define storage and application
const storage = new MemoryStorage();
const app = new Application({
  storage,
  ai: {
    planner,
  },
});

app.conversationUpdate("membersAdded", async (turnContext: TurnContext) => {
  const welcomeText = "How can I help you today?";
  for (const member of turnContext.activity.membersAdded) {
    if (member.id !== turnContext.activity.recipient.id) {
      await turnContext.sendActivity(MessageFactory.text(welcomeText));
    }
  }
});

app.message("reset", resetMessage);

app.ai.action(AI.HttpErrorActionName, httpErrorAction);
app.ai.action("searchDocuments", searchDocuments);

export default app;

Solution

Adding assistant vector_store_id to the planner. Something like:

const planner = new preview.AssistantsPlanner({
   apiKey: config.azureOpenAIKey,
   assistant_id: config.azureOpenAIAssistantId,
   endpoint: config.azureOpenAIEndpoint,
   vectorstoreId: config.vectorstoreId
});

Additional Context

No response

@Drahokma Drahokma added the enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant