@llamaindex/openai
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -0,1 +1,2 @@ | ||
import { LLMAgentParams, LLMAgentWorker, LLMAgent } from '@llamaindex/core/agent'; | ||
import { BaseEmbedding } from '@llamaindex/core/embeddings'; | ||
@@ -9,2 +10,9 @@ import { Tokenizers } from '@llamaindex/env'; | ||
type OpenAIAgentParams = LLMAgentParams; | ||
declare class OpenAIAgentWorker extends LLMAgentWorker { | ||
} | ||
declare class OpenAIAgent extends LLMAgent { | ||
constructor(params: OpenAIAgentParams); | ||
} | ||
interface AzureOpenAIConfig extends AzureClientOptions { | ||
@@ -303,2 +311,2 @@ /** @deprecated use "deployment" instead */ | ||
export { ALL_AVAILABLE_OPENAI_MODELS, ALL_OPENAI_EMBEDDING_MODELS, type AzureOpenAIConfig, GPT35_MODELS, GPT4_MODELS, O1_MODELS, OpenAI, type OpenAIAdditionalChatOptions, type OpenAIAdditionalMetadata, OpenAIEmbedding, OpenAISession }; | ||
export { ALL_AVAILABLE_OPENAI_MODELS, ALL_OPENAI_EMBEDDING_MODELS, type AzureOpenAIConfig, GPT35_MODELS, GPT4_MODELS, O1_MODELS, OpenAI, type OpenAIAdditionalChatOptions, type OpenAIAdditionalMetadata, OpenAIAgent, type OpenAIAgentParams, OpenAIAgentWorker, OpenAIEmbedding, OpenAISession }; |
@@ -1,7 +0,10 @@ | ||
import { BaseEmbedding } from '@llamaindex/core/embeddings'; | ||
import { LLMAgentWorker, LLMAgent } from '@llamaindex/core/agent'; | ||
import { Settings } from '@llamaindex/core/global'; | ||
import { getEnv, Tokenizers } from '@llamaindex/env'; | ||
import { AzureOpenAI, OpenAI as OpenAI$1 } from 'openai'; | ||
import { isDeepEqual } from 'remeda'; | ||
import { wrapEventCaller, wrapLLMEvent } from '@llamaindex/core/decorator'; | ||
import { ToolCallLLM } from '@llamaindex/core/llms'; | ||
import { wrapEventCaller, wrapLLMEvent, extractText } from '@llamaindex/core/utils'; | ||
import { extractText } from '@llamaindex/core/utils'; | ||
import { BaseEmbedding } from '@llamaindex/core/embeddings'; | ||
@@ -830,6 +833,14 @@ // NOTE we're not supporting the legacy models as they're not available for new deployments | ||
for await (const part of stream){ | ||
if (part.choices.length === 0) continue; | ||
if (part.choices.length === 0) { | ||
if (part.usage) { | ||
yield { | ||
raw: part, | ||
delta: "" | ||
}; | ||
} | ||
continue; | ||
} | ||
const choice = part.choices[0]; | ||
// skip parts that don't have any content | ||
if (!(choice.delta.content || choice.delta.tool_calls)) continue; | ||
if (!(choice.delta.content || choice.delta.tool_calls || choice.finish_reason)) continue; | ||
let shouldEmitToolCall = null; | ||
@@ -894,2 +905,14 @@ if (choice.delta.tool_calls?.[0].id && currentToolCall && choice.delta.tool_calls?.[0].id !== currentToolCall.id) { | ||
class OpenAIAgentWorker extends LLMAgentWorker { | ||
} | ||
class OpenAIAgent extends LLMAgent { | ||
constructor(params){ | ||
const llm = params.llm ?? (Settings.llm instanceof OpenAI ? Settings.llm : new OpenAI()); | ||
super({ | ||
...params, | ||
llm | ||
}); | ||
} | ||
} | ||
const ALL_OPENAI_EMBEDDING_MODELS = { | ||
@@ -998,2 +1021,2 @@ "text-embedding-ada-002": { | ||
export { ALL_AVAILABLE_OPENAI_MODELS, ALL_OPENAI_EMBEDDING_MODELS, GPT35_MODELS, GPT4_MODELS, O1_MODELS, OpenAI, OpenAIEmbedding, OpenAISession }; | ||
export { ALL_AVAILABLE_OPENAI_MODELS, ALL_OPENAI_EMBEDDING_MODELS, GPT35_MODELS, GPT4_MODELS, O1_MODELS, OpenAI, OpenAIAgent, OpenAIAgentWorker, OpenAIEmbedding, OpenAISession }; |
{ | ||
"name": "@llamaindex/openai", | ||
"description": "OpenAI Adapter for LlamaIndex", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"type": "module", | ||
@@ -34,3 +34,3 @@ "main": "./dist/index.cjs", | ||
"remeda": "^2.12.0", | ||
"@llamaindex/core": "0.2.6", | ||
"@llamaindex/core": "0.2.7", | ||
"@llamaindex/env": "0.1.12" | ||
@@ -37,0 +37,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
89980
2344
+ Added@llamaindex/core@0.2.7(transitive)
- Removed@llamaindex/core@0.2.6(transitive)
Updated@llamaindex/core@0.2.7