Skip to content

Commit

Permalink
fix: by comment about added 'tool' role in messageType
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-balfe committed Dec 13, 2024
1 parent 04b4f76 commit c81e9a5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions .changeset/pink-days-appear.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
"@llamaindex/anthropic": minor
"@llamaindex/llamaindex-test": minor
"llamaindex": minor
"@llamaindex/core": minor
"@llamaindex/anthropic": patch
"llamaindex": patch
"@llamaindex/core": patch
---

added support for tool calls with results in message history for athropic agent
2 changes: 1 addition & 1 deletion packages/core/src/llms/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface LLM<
): Promise<CompletionResponse>;
}

export type MessageType = "user" | "assistant" | "system" | "memory" | "tool";
export type MessageType = "user" | "assistant" | "system" | "memory";

export type TextChatMessage<AdditionalMessageOptions extends object = object> =
{
Expand Down
1 change: 0 additions & 1 deletion packages/llamaindex/src/llm/gemini/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export class GeminiHelper {
system: "user",
assistant: "model",
memory: "user",
tool: "user",
};

public static readonly ROLES_FROM_GEMINI: Record<
Expand Down
4 changes: 2 additions & 2 deletions packages/llamaindex/tests/llm/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe("Message Formatting", () => {
},
},
{
role: "tool",
role: "assistant",
content: "The weather in London is sunny, +20°C",
options: {
toolResult: {
Expand Down Expand Up @@ -276,7 +276,7 @@ describe("Message Formatting", () => {
],
},
{
role: "user",
role: "user", // anthropic considers all that comes not from their inference API is user role
content: [
{
type: "tool_result",
Expand Down

0 comments on commit c81e9a5

Please sign in to comment.