Chat demo App: How to fetch function arguments on the view?

Abierto
#99 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
swift
Área
mobile

Línea de trabajo

Start by reading the Chat demo’s message model and view, especially the case .function rendering shown in the issue, then trace where function-call arguments are stored in the Swift package. The request is to make individual arguments available to the view for uses such as tables or graphs; done means the demo can access a requested property such as degrees. The issue has had no comment for 529 days, so confirm the approach with maintainers before starting.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Is your feature request related to a problem? Please describe.
Would be great to be able to fetch function arguments on the view.

Describe the solution you'd like

When defined:

  let weatherFunction = ChatFunctionDeclaration(
            name: "getWeatherData",
            description: "Get the current weather in a given location",
            parameters: .init(
              type: .object,
              properties: [
                "location": .init(type: .string, description: "The city and state, e.g. San Francisco, CA"),
                "degrees": .init(type: .string, description: "The degrees, in celsius. Ex: 10c")

              ],
              required: ["location"]
            )
        )

When prompted "show me the weather in San Francisco"...

Current demo app shows the on the bubble: message.content
Would be great to be able to fetch the property, ex: function.degrees.

This would enable to place specific function properties on tables, graphs, etc...


 var body: some View {
        HStack {
            switch message.role {
            case .assistant:
                Text(message.content)
                    .padding(.horizontal, 16)
                    .padding(.vertical, 12)
                    .background(assistantBackgroundColor)
                    .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
                Spacer(minLength: 24)
            case .user:
                Spacer(minLength: 24)
                Text(message.content)
                    .padding(.horizontal, 16)
                    .padding(.vertical, 12)
                    .foregroundColor(userForegroundColor)
                    .background(userBackgroundColor)
                    .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
            case .function:
              Text(message.content)
                  .font(.footnote.monospaced())
                  .padding(.horizontal, 16)
                  .padding(.vertical, 12)
                  .background(funcBackgroundColor)
                  .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
              Spacer(minLength: 24)
            case .system:
                EmptyView()
            }
        }
    }
Lenguaje dominante
Swift
Estrellas
2.9k
Forks
519
Merge medio
2 d 14 h
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MacPaw/OpenAI

Todos los issues de MacPaw/OpenAI

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.