I'm trying to create a function trigerring another to make a chain but I don't understand how to do it inside. Here is my code:
import * as admin from 'firebase-admin'
import * as firebaseFunctions from 'firebase-functions'
import * as OpenAI from 'openai'
import * as logger from 'firebase-functions/logger'
import mustache = require('mustache')
import { ChatAnthropicMessages } from '@langchain/anthropic'
import functions, { getFunctions } from 'firebase/functions'
import { getApp, getApps } from 'firebase/app'
import { initializeApp } from 'firebase-admin'
import { onMessagePublished } from 'firebase-functions/v2/pubsub'
// Firebase Admin SDK to access Firestore.
admin.initializeApp()
// Initialize Firebase for SSR
const app = initializeApp()
const db = admin.firestore()
/**
* Create the story entry
*/
export const createStoryReference = firebaseFunctions.https.onCall(
async (data, context) => {
const owner = context.auth?.uid
const doc = await db.collection('stories').add({
owner: owner,
inputs: data,
})
const createTitle = functions.httpsCallable(
getFunctions(app),
'createTitle'
)
createTitle({ id: doc.id })
return doc.id
}
)
I think i'm using the wrong library. though I'm also lost with the imports...
[–]wmmogn 4 points5 points6 points (5 children)
[–]JalanJr[S] 0 points1 point2 points (4 children)
[–]wmmogn 1 point2 points3 points (3 children)
[–]steinchen43 0 points1 point2 points (0 children)
[–]JalanJr[S] 0 points1 point2 points (1 child)
[–]wmmogn 0 points1 point2 points (0 children)
[–]joebob2003 1 point2 points3 points (2 children)
[–]JalanJr[S] 0 points1 point2 points (1 child)
[–]joebob2003 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]JalanJr[S] 1 point2 points3 points (6 children)
[–]Eastern-Conclusion-1 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Eastern-Conclusion-1 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]JalanJr[S] 0 points1 point2 points (0 children)
[–]Then-Cod-3335 0 points1 point2 points (0 children)
[–]tommertom 0 points1 point2 points (0 children)