tmc / langchaingo

LangChain for Go, the easiest way to write LLM-based programs in Go
https://tmc.github.io/langchaingo/
MIT License
4.42k stars 598 forks source link

Vertex AI: Context in Chat Completion #280

Closed vsumit89 closed 6 months ago

vsumit89 commented 1 year ago

There's no option for adding context in vertex AI API

redanesconde commented 1 year ago

should be solved in this PR #299.

see how to implement:


    //systemChatMessage should be the 1st one in the list
    prompt := schema.SystemChatMessage{
        Content: "Hello, I am a bot and my name is Usher. I am here to help you with your business. What would you like to do today?",
    }
    question := schema.HumanChatMessage{
        Content: "What is your name?",
    }

    fmt.Println("---ASK---")
    fmt.Println(question.GetContent())

    messages := []schema.ChatMessage{prompt, question}
    //messages = append(messages, question)

    start := time.Now()
    completion, err := llm.Call(ctx, messages)
tmc commented 6 months ago

Yes this can be considered solved now.