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

unifed logic for function call / agent #692

Closed
himself65 opened this issue Apr 5, 2024 · 0 comments · Fixed by #728
Closed

unifed logic for function call / agent #692

himself65 opened this issue Apr 5, 2024 · 0 comments · Fixed by #728
Assignees
Labels
enhancement New feature or request

Comments

@himself65
Copy link
Member

himself65 commented Apr 5, 2024

Since gpt3.5/4 and Claude-3 are all support function calls, they have different way to use it. It's necessary to use a better way to handle it on the LlamaindexTS side to make user easy to switch without overhead.

type MessageRole = 'user' | 'ai' | 'system'
type MessageContentPart = MessageContentTextPart | MessageContentImagePart // ...
type Message = {
  role: MessageRole
  content: string | MessageContentPart[]
}

interface MessageInterop<LLMMessage> {
  toLLMMessage(messages: Message[]): LLMMessage[]
  fromAIMessage(message: LLMMessage[]): Message[]
}
interface LLM<LLMMessage> extends MessageInterop<LLMMessage> {
  // ...
}

type Tool<Input> = {
  handler: (input: Input) => string | Promise<string>
  metadata: {
    name: string
    // ... there should be json schema so that it could support zod
  }
}

type LLMFunctionCallEvent = LLMBaseEvent<'llm-function-call', {
  tool: Tool; // <-- should be BaseTool<Input>
  input: unknown // <-- should be Input
}>
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

Successfully merging a pull request may close this issue.

1 participant