Skip to content

res.ChatStreamingResponse undefined #292

Description

@navidmadannezhad

Dear OpenRouter Team.

Steps to reproduce the issue:
Just copy and paste the Send example in documentation

package main

import(
	"context"
	"os"
	openrouter "github.com/OpenRouterTeam/go-sdk"
	"github.com/OpenRouterTeam/go-sdk/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := openrouter.New(
        openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
    )

    res, err := s.Chat.Send(ctx, components.ChatRequest{
        Messages: []components.ChatMessages{
            components.CreateChatMessagesSystem(
                components.ChatSystemMessage{
                    Content: components.CreateChatSystemMessageContentStr(
                        "You are a helpful assistant.",
                    ),
                    Role: components.ChatSystemMessageRoleSystem,
                },
            ),
            components.CreateChatMessagesUser(
                components.ChatUserMessage{
                    Content: components.CreateChatUserMessageContentStr(
                        "What is the capital of France?",
                    ),
                    Role: components.ChatUserMessageRoleUser,
                },
            ),
        },
    }, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        defer res.ChatStreamingResponse.Close()

        for res.ChatStreamingResponse.Next() {
            event := res.ChatStreamingResponse.Value()
            log.Print(event)
            // Handle the event
	      }
    }
}

What we get:
res.ChatStreamingResponse undefined (type *operations.SendChatCompletionRequestResponse has no field or method ChatStreamingResponse)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions