Merge pull request #3956 from omnivore-app/fix/update-openai
Upgrade to gpt-4o
This commit is contained in:
@ -34,6 +34,7 @@ import { logger } from '../../utils/logger'
|
||||
import { htmlToMarkdown, markdownToHtml } from '../../utils/parser'
|
||||
import { uploadToBucket } from '../../utils/uploads'
|
||||
import { getImageSize, _findThumbnail } from '../find_thumbnail'
|
||||
import { ANTHROPIC_MODEL, OPENAI_MODEL } from '../../utils/ai'
|
||||
|
||||
export type CreateDigestJobSchedule = 'daily' | 'weekly'
|
||||
|
||||
@ -253,7 +254,7 @@ const createUserProfile = async (
|
||||
preferences: LibraryItem[]
|
||||
): Promise<string> => {
|
||||
const llm = new OpenAI({
|
||||
modelName: 'gpt-4-0125-preview',
|
||||
modelName: OPENAI_MODEL,
|
||||
configuration: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
},
|
||||
@ -297,7 +298,7 @@ const rankCandidates = async (
|
||||
userProfile: string
|
||||
): Promise<RankedItem[]> => {
|
||||
const llm = new OpenAI({
|
||||
modelName: 'gpt-4-0125-preview',
|
||||
modelName: OPENAI_MODEL,
|
||||
configuration: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
},
|
||||
@ -393,7 +394,7 @@ const summarizeItems = async (
|
||||
|
||||
if (model === 'openai') {
|
||||
const llm = new OpenAI({
|
||||
modelName: 'gpt-4-0125-preview',
|
||||
modelName: OPENAI_MODEL,
|
||||
configuration: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
},
|
||||
@ -422,7 +423,7 @@ const summarizeItems = async (
|
||||
// use anthropic otherwise
|
||||
const llm = new ChatAnthropic({
|
||||
apiKey: process.env.CLAUDE_API_KEY,
|
||||
model: 'claude-3-sonnet-20240229',
|
||||
model: ANTHROPIC_MODEL,
|
||||
})
|
||||
|
||||
const prompts = await Promise.all(
|
||||
|
||||
@ -15,6 +15,7 @@ import { stringToHash } from '../utils/helpers'
|
||||
import { logger } from '../utils/logger'
|
||||
import { parsePreparedContent } from '../utils/parser'
|
||||
import { videoIdFromYouTubeUrl } from '../utils/youtube'
|
||||
import { OPENAI_MODEL } from '../utils/ai'
|
||||
|
||||
export interface ProcessYouTubeVideoJobData {
|
||||
userId: string
|
||||
@ -97,7 +98,7 @@ export const createTranscriptHTML = async (
|
||||
}
|
||||
|
||||
const llm = new OpenAI({
|
||||
modelName: 'gpt-4-0125-preview',
|
||||
modelName: OPENAI_MODEL,
|
||||
configuration: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
},
|
||||
|
||||
@ -3,6 +3,7 @@ import { PromptTemplate } from '@langchain/core/prompts'
|
||||
import { authTrx } from '../repository'
|
||||
import { libraryItemRepository } from '../repository/library_item'
|
||||
import { htmlToMarkdown } from '../utils/parser'
|
||||
import { OPENAI_MODEL } from '../utils/ai'
|
||||
|
||||
export const explainText = async (
|
||||
userId: string,
|
||||
@ -10,7 +11,7 @@ export const explainText = async (
|
||||
libraryItemId: string
|
||||
): Promise<string> => {
|
||||
const llm = new OpenAI({
|
||||
modelName: 'gpt-4-0125-preview',
|
||||
modelName: OPENAI_MODEL,
|
||||
configuration: {
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
},
|
||||
|
||||
2
packages/api/src/utils/ai.ts
Normal file
2
packages/api/src/utils/ai.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export const OPENAI_MODEL = 'gpt-4o'
|
||||
export const ANTHROPIC_MODEL = 'claude-3-sonnet-20240229'
|
||||
Reference in New Issue
Block a user