Skip to content

Commit

Permalink
feat!: Update OpenAIEmbeddings' default model to text-embedding-3-sma…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmigloz authored Jan 26, 2024
1 parent 33efdba commit 4346348
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/langchain/lib/src/documents/embeddings/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CacheBackedEmbeddings implements Embeddings {
/// final cacheBackedEmbeddings = CacheBackedEmbeddings.fromByteStore(
/// underlyingEmbeddings: OpenAIEmbeddings(apiKey: openaiApiKey),
/// documentEmbeddingsStore: InMemoryStore(),
/// namespace: 'text-embedding-ada-002',
/// namespace: 'text-embedding-3-small',
/// );
factory CacheBackedEmbeddings.fromByteStore({
required final Embeddings underlyingEmbeddings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class ChatOpenAI extends BaseChatModel<ChatOpenAIOptions> {
/// it using this field.
///
/// Supported encodings:
/// - `cl100k_base` (used by gpt-4, gpt-3.5-turbo, text-embedding-ada-002).
/// - `cl100k_base` (used by gpt-4, gpt-3.5-turbo, text-embedding-3-small).
///
/// For an exhaustive list check:
/// https://github.com/mvitlov/tiktoken/blob/master/lib/tiktoken.dart
Expand Down
4 changes: 2 additions & 2 deletions packages/langchain_openai/lib/src/embeddings/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class OpenAIEmbeddings implements Embeddings {
final Map<String, String>? headers,
final Map<String, dynamic>? queryParams,
final http.Client? client,
this.model = 'text-embedding-ada-002',
this.model = 'text-embedding-3-small',
this.dimensions,
this.batchSize = 512,
this.user,
Expand Down Expand Up @@ -163,7 +163,7 @@ class OpenAIEmbeddings implements Embeddings {

/// The maximum number of documents to embed in a single request.
/// This is limited by max input tokens for the model
/// (e.g. 8191 tokens for text-embedding-ada-002).
/// (e.g. 8191 tokens for text-embedding-3-small).
int batchSize;

/// A unique identifier representing your end-user, which can help OpenAI to
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain_openai/lib/src/llms/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class OpenAI extends BaseLLM<OpenAIOptions> {
/// it using this field.
///
/// Supported encodings:
/// - `cl100k_base` (used by gpt-4, gpt-3.5-turbo, text-embedding-ada-002).
/// - `cl100k_base` (used by gpt-4, gpt-3.5-turbo, text-embedding-3-small).
///
/// For an exhaustive list check:
/// https://github.com/mvitlov/tiktoken/blob/master/lib/tiktoken.dart
Expand Down

0 comments on commit 4346348

Please sign in to comment.